+ 1

What's the 3 means?

var courses = new Array(3); courses[0] = "HTML"; courses[1] = "CSS"; courses[2] = "JS"; document.write(courses[2]); - Hello peers, may I ask, what do “3” means in new Array? Thanks in advance!

31st Dec 2017, 5:10 AM
Vincent Matthew Benito
Vincent Matthew Benito - avatar
1 Resposta
+ 11
3 means the size of the array..You see the array consists 3 elements (0-2) and it can't contain any more.So it is the size of the array
31st Dec 2017, 5:23 AM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar