+ 1
can anyone explain arrays in layman terms?
I'm familiar with the word, heard it many times during my school days. but I dont know what it means in JavaScript. I'm learning JavaScript as my first programming language.
2 Respostas
+ 2
Arrays contain several values (usually with the same data type, but not always in Javascript), accessible via their index number (starting from 0).
var myArray = [42, 23, 78];
for (var i = 0; i < myArray.length; i++) {
document.writeln(myArray[i]);
}
0
Basically it's a regular variable with multiple values.