4-32 Faking Namespace

bigword alert : Namespace

  • a container for variables and functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

greet = 'Hello!';
greet = 'Hola!';

// greet collide
console.log(greet);

var english = {};
var spanish = {};

english.greet = 'Hello!';
spanish.greet = 'Hola!';

english.greetings.greet = 'Hello'; // cannot creating on the fly

/*
var english = {
greeting : {
basic : 'Hello!'
}
};
*/