1. Create an empty object: var o = new object();
2. Create an object literal:
var cricle={x:0,y:0,radius:2}
var homer={
name:"Homer Simpson",
age :34,
married:true,
email: "zzy@163.com"
Settings and queries of 3 attributes
🎜> var book=new object();
book .title="Test";
alert(book,title);
Attribute is a new attribute of an object that is created by assigning a value to it. Although the var keyword is usually used to declare variables, it is not used to declare object properties.
Enumeration of attributes: for/in loop provides a way to traverse object attributes
function displayppName(obj)
{
var name="";
for (var name in obj)
name =name "n"
alert(name);
}