📚 › JavaScript: make pages do things
9. Arrays
Este artículo se traducirá automáticamente. Por ahora se muestra en inglés.
An array stores several values in order. Positions start at 0, so the first item is arr[0]. length tells the count. push adds an item at the end.
Loop through an array with for or forEach.
Ver ejemplo
const fruits = ["mango", "banana"];
fruits.push("jackfruit");
console.log(fruits[0], fruits.length);
✍️ Ahora te toca
Create an array of three colours red, green and blue, then print its length.