5-1函数作为对象中的方法
var obj={name:"ming",sayName:function(){console.log(this.name)}obj.sayName();
函数在对象中作为方法的语法(三种)
<script>/*函数在对象中作为方法的语法(三种)*/var obj = {name:"shang",sayName(){console.log(this.name)//在方法中,谁执行方法,this就指向谁},sayAge:()=>{console.log(18)},saySkill:function(){console.log("javascript")}}obj.sayName();</script>
