Jul 16, 2019 in JavaScript
Q:

How to create an array in js and how to read array elements?

1 Answer

0 votes
Jul 16, 2019

Can you define arrays using the array literal as follows?

  • var x = [];
  • var y = [1, 2, 3, 4, 5];

An array has a length property that is useful for iteration. Can we read elements of an array as follows?

for (var i = 0; i < x.length; i++)

Related questions

+1 vote
Jul 16, 2019 in JavaScript
0 votes
Oct 19, 2019 in JavaScript
...