This commit is contained in:
asd
2021-06-03 10:52:41 +08:00
parent c5f18c6051
commit 907511778b
54 changed files with 3540 additions and 50 deletions

View File

@@ -48,14 +48,13 @@
// 对象 键值对(无序) 数组(有序)
// name sex age 这种类似于变量的东西叫属性
// sayzao saywan这种对象中的函数 叫方法
// 添加属性
var obj={
name:"qwe",
sex:"男",
age:22,
sayzao:function(){
alert("早安")
},
saywan:function(){
alert("晚安")
@@ -65,47 +64,10 @@
// obj.sayzao()
// sayzao()
// 新增属性 obj对象的名字.属性名=属性值
// 新增方法 obj(对象名).方法名=匿名函数
console.log(obj.name)
obj.height=185;
obj.face="好看"
obj.zhuangkuang="单身"
obj.xiaozhushou=function(){
alert("多喝岩浆")
}
obj.cooking=function(time){
if(time==7){
alert("我正在做早饭");
}else if(time==11){
alert("我正在做午饭")
}else if(time==18){
alert("我在做晚饭")
}
}
obj.clean=function(){
alert("我在打扫卫生")
}
obj.wash=function(){
alert("我在把衣服扔到洗衣机里")
}
obj.changename=function(){
this.name="张三"
}
// obj.cooking(7)
// obj.sayzao()
// obj.clean()
// obj.xiaozhushou()
// obj.cooking(11)
// obj.wash()
// obj.cooking(18)
delete obj.saywan
console.log(obj)
</script>
</body>