make new array javascript code example
Example 1: how to make an array in javascript
var names = ["Sanjith", "Pranav", "Aadya", "Saharsh"]
Example 2: how to create an array in javascript
let fruits = ['Apple', 'Banana']
console.log(fruits.length)
Example 3: 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));