📚 › JavaScript: make pages do things
9. Arrays
ستتم ترجمة هذا المقال تلقائيًا. يُعرض بالإنجليزية حاليًا.
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.
عرض المثال
const fruits = ["mango", "banana"];
fruits.push("jackfruit");
console.log(fruits[0], fruits.length);
✍️ دورك الآن
Create an array of three colours red, green and blue, then print its length.