Es6 Object.create 方法 ES6 构造函数 ES6 克隆对象 Es6 Object.create 方法 var roles = { type: "Admin", // Default value of properties displayType : function() { // 方法 which will display type of role console.log(this.type); } } // Create new role type called super_role var super_role = Object.create(roles); super_role.displayType(); // Output:Admin // Create new role type called Guest var guest_role = Object.create(roles); guest_role.type = "Guest"; guest_role.displayType(); // Output:Guest ES6 构造函数 ES6 克隆对象