In how many ways can you create an array in JS?

Posted by Jessica Taylor | Updated on

There are three different ways of creating an array in JavaScript, namely:

  1. By creating instance of an array:
    var someArray = new Array();
  2. By using an array constructor:
    var someArray = new Array(‘value1’, ‘value2’,…, ‘valueN’);
  3. By using an array literal:
    var someArray = [value1, value2,…., valueN];

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers