js create an array code example
Example 1: how to create an array in node js
var myArray = new Array();
var mySecondArray = [];
Example 2: how to make an array in javascript
var names = ["Sanjith", "Pranav", "Aadya", "Saharsh"]
Example 3: how to create an array in javascript
let fruits = ['Apple', 'Banana']
console.log(fruits.length)
Example 4: new array from javascript
const range = (start, stop, step) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step));
range(0, 4, 1);
range(1, 10, 2);
range('A'.charCodeAt(0), 'Z'.charCodeAt(0), 1).map(x => String.fromCharCode(x));