Blogger Information
Blog 48
fans 0
comment 0
visits 36747
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
创建对象的方式(字面量或构造函数)-2018.09.11
雨天的博客
Original
718 people have browsed it

字面量创建对象:

实例

 let obj1 = {
        name :'韩梅',
        sex:'女'
    }
    console.log(obj1.name);

运行实例 »

点击 "运行实例" 按钮查看在线实例

构造函数创建对象:

实例

obj=new Object();
    obj.name='tom';
    obj.age=22;
    obj.sex='男';

运行实例 »

点击 "运行实例" 按钮查看在线实例




Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post