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 = newArray(6);
listB.length = 4294967296; //2 to the 32nd power = 4294967296// RangeError: Invalid array lengthconst listC = newArray(-100) //negative sign// RangeError: Invalid array length
In this page (written and validated by A. Gawali) you learned about
Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: email@example.com.