Advertisement
728x90
You can use the Object.setPrototypeOf() method that sets the prototype (i.e., the internal Prototype property) of a specified object to another object or null. For example, if you want to set prototype of a square object to rectangle object would be as follows,
javascript
1Object.setPrototypeOf(Square.prototype, Rectangle.prototype);
2
3Object.setPrototypeOf({}, null);Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 4
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
261of476