| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Object | [Back] [Original] |
Get to know MDN better
JavaScript Object Object.prototype Object.prototype null null
Object.prototype Object.prototype JavaScript Object.prototype null
Object.prototype Object.prototype null JavaScript
valueOf()toString()toLocaleString() valueOf() toString() __defineGetter__()__defineSetter__()__lookupGetter__()__lookupSetter__() Object.defineProperty() Object.getOwnPropertyDescriptor() __proto__ Object.getPrototypeOf() Object.setPrototypeOf() propertyIsEnumerable() hasOwnProperty() Object.getOwnPropertyDescriptor() Object.hasOwn() isPrototypeOf() prototype instanceof Object.prototype Object.prototype call()
const obj = {
foo: 1,
//
//
//
propertyIsEnumerable() {
return false;
},
};
obj.propertyIsEnumerable("foo"); // false;
Object.prototype.propertyIsEnumerable.call(obj, "foo"); // true;
(Map.prototype.delete() ) delete
JavaScript Object.prototype null Object.create(null) __proto__: null : __proto__ Object.prototype.__proto__ null Object.setPrototypeOf(obj, null)
const obj = Object.create(null);
const obj2 = { __proto__: null };
null Object.prototype /
const normalObj = {}; //
const nullProtoObj = Object.create(null); // "null"
console.log(`normalObj is: ${normalObj}`); // "normalObj is: [object Object]"
console.log(`nullProtoObj is: ${nullProtoObj}`); // : Cannot convert object to primitive value
alert(normalObj); // [object Object]
alert(nullProtoObj); // : Cannot convert object to primitive value
normalObj.valueOf(); // {}
nullProtoObj.valueOf(); // : nullProtoObj.valueOf is not a function
normalObj.hasOwnProperty("p"); // "true"
nullProtoObj.hasOwnProperty("p"); // : nullProtoObj.hasOwnProperty is not a function
normalObj.constructor; // "Object() { [native code] }"
nullProtoObj.constructor; // "undefined"
toString null
nullProtoObj.toString = Object.prototype.toString; // toString
console.log(nullProtoObj.toString()); // "[object Object]"
console.log(`nullProtoObj is: ${nullProtoObj}`); // "nullProtoObj is: [object Object]"
toString() toString() nullProtoObj nullProtoObj (null)
Object.setPrototypeOf(nullProtoObj, Object.prototype) null
const ages = { alice: 18, bob: 27 };
function hasPerson(name) {
return name in ages;
}
function getAge(name) {
return ages[name];
}
hasPerson("hasOwnProperty"); // true
getAge("toString"); // [Function: toString]
null hasPerson getAge
const ages = Object.create(null, {
alice: { value: 18, enumerable: true },
bob: { value: 27, enumerable: true },
});
hasPerson("hasOwnProperty"); // false
getAge("toString"); // undefined
Object.prototype Object.prototype null
const user = {};
//
Object.prototype.authenticated = true;
//
if (user.authenticated) {
//
}
JavaScript null API
Object.groupBy() RegExp.prototype.exec() groups indices.groups Array.prototype[Symbol.unscopables] [Symbol.unscopables] null import.metaimport * as ns from "module"; import() null Object.prototype extends null
JavaScript 2
Object.prototype.valueOf(): Object.prototype.valueOf.call(x) x Object() : Object(x) x undefined null TypeError for...in object Array this Object Object.keys() this null undefined Object() Object
Object.assign()1
Object.create()Object.defineProperties()Object.defineProperty()Object.entries() [key, value]
Object.freeze()Object.fromEntries() [key, value] ( Object.entries )
Object.getOwnPropertyDescriptor()Object.getOwnPropertyDescriptors()Object.getOwnPropertyNames()
Object.getOwnPropertySymbols()Object.getPrototypeOf() ( [[Prototype]] )
Object.groupBy()Object.hasOwn() true false
Object.is()Object.isExtensible()Object.isFrozen()Object.isSealed()Object.keys()
Object.preventExtensions()Object.seal()Object.setPrototypeOf() ( [[Prototype]] )
Object.values()
Object.prototype Object
Object.prototype.__proto__ Object.prototype.constructor Object Object Constructor.prototype constructor
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()new
const o1 = new Object();
const o2 = new Object(undefined);
const o3 = new Object(null);
// const o1 = new Boolean(true)
const o1 = new Object(true);
// BigInt()
//
const o2 = new Object(1n);
Object.prototype ()
apply() this () Node.prototype Function.prototype
const current = Object.prototype.valueOf;
// "-prop-value"
// Object.prototype
Object.prototype.valueOf = function (...args) {
if (Object.hasOwn(this, "-prop-value")) {
return this["-prop-value"];
}
//
//
// apply "super"
// valueOf()
return current.apply(this, args);
};
:
prototype
| ECMAScript 2027 LanguageSpecification # sec-object-objects |
Objectassign()create()defineProperties()defineProperty()entries()freeze()fromEntries()getOwnPropertyDescriptor()getOwnPropertyDescriptors()getOwnPropertyNames()getOwnPropertySymbols()getPrototypeOf()groupBy()hasOwn()is()isExtensible()isFrozen()isSealed()keys()preventExtensions()seal()setPrototypeOf()values()Object/Function| Web Proxy Viewer | New URL | Original Page |