Solution Review: Prototype Property
This lesson will explain the solution to the problem in the previous lesson.
In the previous lesson, you were given the following code to modify.
Press + to interact
function func1(name){this.name = name;}var obj1 = new func1("Bran");func1.prototype = {talk: function(){console.log ("Welcome " + this.name);}}function display(){var obj2 = new func1("Jon");obj2.talk() // worksobj1.talk() // doesn't work}display()
Solution
...Access this course and 1400+ top-rated courses and projects.