fix(challenge): Format constructor property in "OOP: Set Constructor"

pull/13470/head
Samuel Plumppu 2017-02-20 18:41:54 +01:00
parent 22d612dd84
commit ee6c544009
1 changed files with 3 additions and 3 deletions

View File

@ -507,12 +507,12 @@
"id": "587d7daf367417b2b2512b80",
"title": "Remember to Set the Constructor Property when Changing the Prototype",
"description": [
"There is one crucial side effect of manually setting the <code>prototype</code> to a new object. It erased the constructor property! The code in the previous challenge would print the following for <code>duck</code>:",
"There is one crucial side effect of manually setting the <code>prototype</code> to a new object. It erased the <code>constructor</code> property! The code in the previous challenge would print the following for <code>duck</code>:",
"<blockquote>console.log(duck.constructor)<br>// prints undefined - Oops!</blockquote>",
"To fix this, whenever a prototype is manually set to a new object, remember to define the constructor property:",
"To fix this, whenever a prototype is manually set to a new object, remember to define the <code>constructor</code> property:",
"<blockquote>Bird.prototype = {<br>&nbsp;&nbsp;constructor: Bird, // define the constructor property<br>&nbsp;&nbsp;numLegs: 2,<br>&nbsp;&nbsp;eat: function() {<br>&nbsp;&nbsp;&nbsp;&nbsp;console.log(\"nom nom nom\");<br>&nbsp;&nbsp;},<br>&nbsp;&nbsp;describe: function() {<br>&nbsp;&nbsp;&nbsp;&nbsp;console.log(\"My name is \" + this.name); <br>&nbsp;&nbsp;}<br>};</blockquote>",
"<hr>",
"Define the constructor property on the <code>Dog</code> <code>prototype</code>."
"Define the <code>constructor</code> property on the <code>Dog</code> <code>prototype</code>."
],
"challengeSeed": [
"function Dog(name) {",