DEV Community

Discussion on: Top 10 JavaScript Patterns Every Developer Likes

Collapse
 
senpl profile image
Michał Urbanek

var myCar = {
name: 'bmw',
drive: function() {
console.log('I am driving!');
},
panic: function() {
console.log('wait, how do you stop this thing?');
}
};

//Usages:

var youcar = Object.create(Car);

console.log(yourcar.name); //'bmw'
I guess it should be var Car or create(MyCar)