您当前的位置: 首页 > 

暂无认证

  • 5浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

JS中属性注意点

发布时间:2020-08-15 16:19:47 ,浏览量:5

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <script> function Person(myName, myAge) { this.name=myName; this.age=myAge; } Person.prototype={ constructor:Person, currentType:"ren", say:function() { console.log("666"); } }; let obj = new Person("lnj", 34); console.log(obj.currentType); console.log(obj.__proto__.currentType); obj.currentType="新设置的值"; console.log(obj.currentType); console.log(obj.__proto__.currentType); </script> </body> </html> 
关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.0736s