This is more of a general query about colons and assignment operators (equal signs)
Within objects, I’ve seen colons and equal signs used to assign properties. I feel like the appropriate use of an equal sign is at the beginning of the object (i.e. function Dog() = {
) and a colon is to indicate the value of a property.
Would someone mind clarifying this rule?
Thanks as always
Nick
Tell us what’s happening:
Describe your issue in detail here.
**Your code so far**
function Dog(name) {
this.name = name;
}
// Only change code below this line
Dog.prototype = {
numLegs: 4,
eat: function() {
console.log("nom nom nom");
},
describe: function() {
console.log("My name is " + this.name);
}
};
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36
Challenge: Remember to Set the Constructor Property when Changing the Prototype
Link to the challenge: