JavaScript Object.setPrototypeOf() MethodLast Updated : 17 Mar 2025 The Object.setPrototypeOf() method sets the prototype (i.e., the internal [[Prototype]] property) of a specified object to another object or null. All JavaScript objects inherit properties and methods from a prototype. It is generally considered the proper way to set the prototype of an object. Syntax:Parameters:obj: It is the object which is to have its prototype set. Prototype: It is the object's new prototype (an object or null). Return value:This method returns the specified object. Browser Support:
Example 1Output: [object Object] {
drive: drive() {
return 'Add raay';
},
net: net() {
return 'use net';
}
}
"use net"
"Add raay"
Example 2Output: "people makes" Example 3Output: [object Object] {
drive: drive() {
return 'driving toyota';
},
wifi: wifi() {
return 'carry';
}
}
"carry"
Next TopicJavaScript Objects |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India