Create int[] with value as 0,1,2,3... length in Javascript
Array.length
const clothing = ['shoes', 'shirts', 'socks', 'sweaters'];
console.log(clothing.length);
// expected output: 4
The value of the length property is an integer with a positive sign and a value less than 2 to the 32nd power (2^32).
const listA = [1,2,3];
const listB = new Array(6);
console.log(listA.length);
// 3
console.log(listB.length);
// 6
listB.length = 4294967296; //2 to the 32nd power = 4294967296
// RangeError: Invalid array length
const listC = new Array(-100) //negative sign
// RangeError: Invalid array length