Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions javascript/design_patterns/constructorPattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function Computer(model, size, age, price){
this.price = price;

this.toString = function(){
return "My computer is a " + this.model + ", is " + this.size + " big, " + this.age + " old and cost me $" + this.price.
return "My computer is a " + this.model + ", is " + this.size + " big, " + this.age + " old and cost me $" + this.price
}
}

Expand Down Expand Up @@ -46,8 +46,8 @@ Computer.prototype.toString = function(){

//Usage

var mac = new myComputer("Mac", "15inch", "2 years", 1000);
var pc = new myComputer("Chromebook", "13inch", "1 year", 500);
var mac = new Computer("Mac", "15inch", "2 years", 1000);
var pc = new Computer("Chromebook", "13inch", "1 year", 500);

console.log(mac.toString());
console.log(pc.toString());
Expand Down