Recently, I've been honing my JavaScript skills and decided to test them with the following code snippet:
var Intel = ["a", "v", "f", "c", "s"];
if (Intel && Intel.constructor == Array) {
alert('correct');
} else {
alert("false");
}
alert(Intel.length);
function showThemAll() {
// this function will display every item in the array
for (var i = 0; i <= Intel.length; i++) {
// alert each item in the array
alert(Intel[i]);
}
}
showThemAll();
Despite getting the correct result, I'm puzzled by an 'undefined' alert that pops up. Can anyone shed some light on this issue?