编程语言
首页 > 编程语言> > JavaScript学习笔记07--objects

JavaScript学习笔记07--objects

作者:互联网

  1. objects定义

    

const myObj = {
    myName: "yuxian",
    age: 21,
}
console.log(myObj);

 

  2.Objects操作函数

    2.1 直接取出元素

const myObj = {
    myName: "yuxian",
    age: 21,
}
console.log(myObj);
console.log(myObj.myName);
console.log(myObj['myName']);

     2.3 添加元素

const myObj = {
    myName: "yuxian",
    age: 21,
}
myObj.location = 'anhui';
console.log(myObj);

 

标签:console,07,--,JavaScript,yuxian,myName,myObj,const,log
来源: https://www.cnblogs.com/yuxiannana/p/16329051.html