| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Object/proto | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
Avoid using this feature in new projects.
Changing __proto__ is slow and can cause surprising bugs.
This feature may be a candidate for removal from web standards or browsers.
:
[[Prototype]] , JavaScript, , JavaScript. , obj.__proto__ = ..., , , [[Prototype]] . , [[Prototype]] . [[Prototype]], Object.create().
:
Object.prototype.__proto__, ECMAScript 6. , Object.getPrototypeOf().
__proto__ Object ( ), [[Prototype]] ( null), .
__proto__ . EcmaScript, . __proto__ ECMAScript 6 . , [[Prototype]] , , .
__proto__ , [[Prototype]] . Object.create(). .
var shape = {},
circle = new Circle();
//
shape.__proto__ = circle;
//
console.log(shape.__proto__ === circle); // true
: , proto .
__proto__ [[Prototype]] . , , Object. Function. , new fun, fun -, JavaScript (Array, Boolean, Date, Number, Object, String , JavaScript), fun.prototype. , new fun, fun , , fun.prototype new fun. fun.prototype , fun [[Prototype]], new fun [[Prototype]].
__proto__ [[Prototype]] . Object.isExtensible(): , TypeError. null. .
__proto__ Object , . __proto__ , , , Object, Object, . Object - __proto__, Object.
var noProto = Object.create(null);
console.log(typeof noProto.__proto__); // undefined
console.log(Object.getPrototypeOf(noProto)); // null
noProto.__proto__ = 17;
console.log(noProto.__proto__); // 17
console.log(Object.getPrototypeOf(noProto)); // null
var protoHidden = {};
Object.defineProperty(protoHidden, "__proto__", {
value: 42,
writable: true,
configurable: true,
enumerable: true,
});
console.log(protoHidden.__proto__); // 42
console.log(Object.getPrototypeOf(protoHidden) === Object.prototype); // true
Employee, , __proto__ , prototype.
// ,
function Employee() {
/* */
}
// Employee
var fred = new Employee();
//
fred.__proto__ === Employee.prototype; // true
fred Employee, fred.__proto__ :
function Cow() {
/* */
}
// __proto__
fred.__proto__ = Cow.prototype;
fred Cow.prototype, Employee.prototype, , Employee.prototype.
var obj = {};
Object.preventExtensions(obj);
obj.__proto__ = {}; // TypeError
, __proto__ Object.prototype, null:
var b = {};
Object.prototype.__proto__ = Object.create(
null, // [[Prototype]]
{
hi: {
value: function () {
alert("hi");
},
},
},
);
b.hi();
__proto__ Object null, , , , null, TypeError __proto__, null ( Object ).
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-object.prototype.__proto__ |
:
ES6 __proto__ ( ). - , Object.getPrototypeOf() Object.setPrototypeOf().
This page was last modified on 29 . 2026 . by MDN contributors.
ObjectObject.assign()Object.create()Object.defineProperties()Object.defineProperty()Object.entries()Object.freeze()Object.fromEntries()Object.getOwnPropertyDescriptor()Object.getOwnPropertyDescriptors()Object.getOwnPropertyNames()Object.getOwnPropertySymbols()Object.getPrototypeOf()groupBy()hasOwn()Object.is()Object.isExtensible()Object.isFrozen()Object.isSealed()Object.keys()Object.preventExtensions()Object.seal()Object.setPrototypeOf()Object.values()Object.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()Object/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |