Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.
Well done!
You have completed (UPI) Chapter 7: Advanced JavaScript Object Handling!
Instruction
Shadowing properties
If you define a property directly on an object that already exists in its prototype, the new property will shadow the prototype's property:
const myDate = new Date(1995, 11, 17);
console.log(myDate.getYear()); // Outputs: 95
myDate.getYear = function () {
console.log("Something else!");
};
myDate.getYear(); // Outputs: Something else!
Here, the getYear()
method defin...