This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.

Smartphone icons created by Freepik - Flaticon

JavaScript Arrays

Creating an Array

Avoid using new Array(). Use [] instead.




const points = new Array(40, 100, 1, 5, 25, 10);
document.getElementById("demo").innerHTML = points[0];  
const pointz = [40, 100, 1, 5, 25, 10];
document.getElementById("demo1").innerHTML = pointz[0];
document.getElementById("demo2").innerHTML = points;
document.getElementById("demo3").innerHTML = pointz;