JavaScript – Object – Chapter 1

Object Literals:

var x={};

var point={x=0,y=0};

Creating Objects with new:

var js-new Object();


Every Javascript object has a second javascript object associated with it. The second object is known as prototype.



That creates a new object.

var o1 = Object.create({x:1, y:2});// o1 inherits x and y


var o{



return this.a+1;



var  p= Object.create(o);


p.m();//will trace 11.

 JSON Serializing Objects:

ECMAScript 5 provides a method JSON.stringfy() and JSON.parser() to seralize and restore Javscript objects.

o = {x:1, y:{z:[false,null,””]}}; // Define a test object
s = JSON.stringify(o); // s is ‘{“x”:1,”y”:{“z”:[false,null,””]}}’
p = JSON.parse(s); // p is a deep copy of o

—Chapter 1 END.


About Saran

Hello there!!! I'm Saravanan, born and living in India. The main reason i decided to start this project it was because there should be a way to transfer my knowledge which i experimented in flash to all. i try to concentrate as much as possible all kind of issues can appear to someone is developing an Flash application. If you need help, or if you would like to see in this blog some issues, send me an e-mail to Follow Me: twitter: Best Regards, SRK
This entry was posted in MyStudy. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s