main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var Batman = {
    // attributes
    first_name:         "Bruce",
    last_name:          "Wayne",
    affiliation:        "JLA",
    arch_enemies:       ["the Joker","the Riddler", "the Penguin"],
    sidekick:           "Robin",

    // methods
    secret_id : function(x) {
       return this.first_name + " " + this.last_name;
    }
};

console.log( Batman.sidekick );
console.log( Batman.secret_id() );
for ( i = 0; i < Batman.arch_enemies.length; i++) {
    console.log( Batman.arch_enemies[i] );
}
Native Browser JavaScript