A container to keep variables and functions. Typically it keeps functions and variables (with the same name) separate.
1 2 3 4 |
var greet = "hello"; var greet = "hola"; console.log(greet); // hola |
One way to separate them is to use object literals.
1 2 3 4 5 |
var english = {}; var spanish = {}; english.greet = "hello"; spanish.greet = "hola"; |
Hence these variables become containers to make sure names do not collide with others.