javascritp new array code example
Example 1: how i create array in javascript
var fruits = ['Apple', 'Banana'];
console.log(fruits.length);
Example 2: 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));
Example 3: array in js
function Array() { return []; }
alert(Array(1, 2, 3));
Example 4: how to get create an array in javascript
let names = ['Michael', 'Adam', 'NetNinja'];
conosle.log(names[0]);