Edit in JSFiddle

$(document).ready(function () {
    var a = ['test', 'test2'];
    a.name = "Test Array";
    log(a);
    log(a.length);

    log("Now let's loop over all the items in the array to see what keys we have.");
    log("---------------------------------------------------");
    for (var i in a) {
        log(i);
    }

    log("Using those keys, let's access each items value.");
    log("---------------------------------------------------");
    for (var i in a) {
        log(a[i]);
    }

    log("Now, let's use the 'length' property when iterating");
    log("---------------------------------------------------");
    for (var i = 0; i < a.length; i++) {
        log(a[i]);
    }
});
<div id="log"></div>

              

External resources loaded into this fiddle: