Loading...
X

Show Love to the Object Literal | Core JavaScript 1.5 Guide:Literals

Defining an object is via literal notation. Supported in JavaScript1.2 and above, it’s a more robust form of creating an object on the fly.
Neat and clean approach to write reusable, readable and maintainable JavaScript code.

Show Love to the Object Literal:
http://ajaxian.com/archives/show-love-to-the-object-literal

Object literals beauty lies in Namespaces, which reduces the number of global variables in your pages. It uses a technique known as branching, which allows you to use common utility
functions without worrying about browser sniffing.

That’s where Singleton Design Pattern comes into the picture, as far as I know, it is the most widely use design pattern these days in JavaScript world.

Using global variables in your page presents a huge risk, and a namespace created with a singleton is one of the best ways to remove those global variables. I stuck many times using global variables and also consume good amount of memory.

Core JavaScript 1.5 Guide:Literals [Some basics of literals]:
https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Literals

One observation on “Show Love to the Object Literal | Core JavaScript 1.5 Guide:Literals

Leave Your Observation

Your email address will not be published. Required fields are marked *