Saturday, 31 August 2013

Javascript object declaration

Javascript object declaration

What is the difference between the below two declarations ?
This
var person={firstname:"John",lastname:"Doe",id:3423};
and this
var person=new Object();
person.firstname="John";
person.lastname="Doe";
person.id=3423;
So person is a variable or object ?
Thanks in advance! :)

No comments:

Post a Comment