1.使用对象字面量的方式
var cat = {}
vat.name = "kity"
cat.name = 2
cat.shyHello = function(){
alert('你好')
}
2.使用工厂方式创建
var dog = new Object
vat.name = "kity"
cat.name = 2
cat.shyHello = function(){
alert('汪汪汪')
}
3.用函数模拟
function Person() {}
var personOne = new Person()
personOne.name = 'tom'
标签:function,name,方式,创建对象,cat,var,kity,几种,personOne
From: https://blog.51cto.com/u_16202629/6872553