Show List
JavaScript Arrays
Arrays in JavaScript are ordered lists of values, denoted by square brackets []
. Each value in an array is called an element, and elements can be of different data types, including numbers, strings, and even other arrays or objects.
Here is an example of an array in JavaScript:
let numbers = [1, 2, 3, 4];
Arrays in JavaScript are dynamic, which means you can add or remove elements at any time. You can access individual elements in an array by using square brackets with an index number, starting from zero.
Here is an example of accessing elements in an array:
let numbers = [1, 2, 3, 4];
console.log(numbers[0]); // 1
console.log(numbers[3]); // 4
Leave a Comment