JS中创建对象的方式 一、创建对象 1.字面量创建 var dog = {name: 'wangcai', age: 3, bark: function (){ console.log('Wang wang'); }}; 2.new关键字 var dog = new Object(); dog.name = 'wangcai'; dog.age = 3; dog.bark = function (){ console.log('Wang wang'); } 3.构造函数 function dog(