0
Hello I recently started using this platform to try to clarify some doubts and I’m having some difficulties in creating arrays to store data through Javascript.
I think the mistake is something simple yet I can’t determine what it is.
carros = ["Fiat", "Ferrari", "Toyota"];
I appreciate all the help already provided.
If the problem was creating an array, congratulations ,vc have already created. Just give a console.log(cars) that will see the array. You can give a length cars. to see the size of the array among many other things that can be done.
– LeAndrade
What exactly is your question? You put the javascript code in the snippet as html, and so the code appears written on the screen, because normally nothing would appear. Creating an array does not imply showing anything anywhere.
– Isac
This array you have placed can be accessed like this:
carros[0]
(will return the first index of the array), and so on. You access the array elements using square brackets, with the first index being 0 (zero).– Rodrigo Tognin
I couldn’t explain it very well but the user @Davidmv has already helped me in this case. But I appreciate the information given for future questions on this platform :)
– Gonçalo Sebastião