js(object)

look for command and detail using information

link "mdn": https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/

1.对象

<script>
    let name = {
        user: "jim",
        age: 34
    };                     //name即为创建的对象,后面可以直接调用
    console.log(name.age)
    console.log(name.user)
    name.user = "devid"
    name.get = function(){
        return `${this.user}'s' age is ${this.age}`;      //this代表对象内容
    }
    console.log(name.get())
</script>

  

posted @ 2022-10-12 20:16  JASON_yul  阅读(26)  评论(0)    收藏  举报