How to create an array in JavaScript?


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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *