<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
//创建对象的方式(1)
/*let obj=new Object();
obj.name="cyg";
obj.age=666;
obj.say=function()
{
console.log("贵哥好");
}
console.log(obj.name);
console.log(obj.age);
obj.say();*/
//创建对象的第二种方式
/*let obj={};
obj.name = "lnj";
obj.age = 33;
obj.say = function () {
console.log("hello world");
}
console.log(obj.name);
console.log(obj.age);
obj.say();*/
//创建对象的第三种方式
/*let obj={
name:"lnj",
age:33,
say:function()
{
console.log("hello world");
}
};
console.log(obj.name);
console.log(obj.age);
obj.say();*/
</script>
</body>
</html>