in JavaScript by
Q:
How to create an array in JavaScript?

1 Answer

0 votes
by

There are 3 ways to create an array in JavaScript.

  1. By array literal
  2. By creating an instance of Array
  3. By using an Array constructor

Let's see a simple code to create an array using object literal.

  1. var emp=["Shyam","Vimal","Ratan"];    

Related questions and answers

+1 vote
asked Jan 10, 2021 in JavaScript by rajeshsharma
0 votes
asked Sep 18, 2021 in JavaScript by sharadyadav1986
0 votes
asked Jun 8 in JavaScript by sharadyadav1986
...