Javatpoint Logo
Javatpoint Logo

JavaScript Object.setPrototypeOf() Method

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.



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:

Chrome 34
Edge Yes
Firefox 31
Opera Yes

Example 1


 [object Object] {
  drive: drive() {
    return 'Add raay';
  net: net() {
    return 'use net';
"use net"
"Add raay"

Example 2


"people makes"

Example 3


[object Object] {
 drive: drive() {
    return 'driving toyota';
  wifi: wifi() {
    return 'carry';

Next TopicJavaScript Objects

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA