How do you create a new object in JavaScript?

profile=new Object();
profile.FName="Vijayakumar";
profile.Lname="S";
document.write(profile.FName+" "+profile.Lname);

Created Object & new instances of an Object & added 2 properties to it... :)

var me = {fname : "Vimal", lname : "Anand", age : 23, workplace:"The Hackett Group"}
//Created an object "me"

The object's children can be used as "Object.firstChild" eg: "console.log(me.fname)"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.