file stringlengths 16 94 | text stringlengths 32 24.4k | vector list |
|---|---|---|
javascript/reference/global_objects/object/__lookupsetter__/index.md | JavaScript - Global Objects - Object - lookupSetter - Syntax - Parameters:
- `prop`: A string containing the name of the property whose setter should be returned. | [
-0.9210689067840576,
-0.6875923275947571,
-1.3829365968704224,
-0.06633370369672775,
-0.3794620633125305,
-1.9446953535079956,
-0.002991695422679186,
0.6658480763435364,
0.18082787096500397,
-0.5089201331138611,
-0.9589751362800598,
1.0347058773040771,
-0.2400784194469452,
0.50350469350814... |
javascript/reference/global_objects/object/__lookupsetter__/index.md | JavaScript - Global Objects - Object - lookupSetter - Syntax - Return value:
The function bound as a setter to the specified property. Returns `undefined` if no such property is found, or the property is a data property. | [
-1.2133070230484009,
-0.21249133348464966,
-1.3743841648101807,
0.4626397490501404,
-0.4124516546726227,
-1.6637656688690186,
-0.004674097057431936,
1.380125880241394,
0.4341006577014923,
-0.1569671630859375,
-0.5407820343971252,
0.9107276797294617,
0.19146110117435455,
0.3872722387313843,... |
javascript/reference/global_objects/object/__lookupsetter__/index.md | JavaScript - Global Objects - Object - lookupSetter - Description:
All objects that inherit from `Object.prototype` (that is, all except `null`-prototype objects) inherit the `__lookupSetter__()` method. If a setter has been defined for an object's property, it's not possible to reference the setter function through t... | [
-1.5801548957824707,
-0.14803239703178406,
-1.572448492050171,
0.7348642349243164,
0.02118516154587269,
-2.105215311050415,
0.3657738268375397,
1.2242988348007202,
-0.04994584247469902,
-0.5833536386489868,
-0.4373008608818054,
0.7186198830604553,
0.15493319928646088,
0.5800853967666626,
... |
javascript/reference/global_objects/object/__lookupsetter__/index.md | JavaScript - Global Objects - Object - lookupSetter - Examples - Using lookupSetter():
Example:
const obj = {
set foo(value) {
this.bar = value;
},
};
obj.__lookupSetter__("foo");
// [Function: set foo] | [
-0.40598222613334656,
0.15119843184947968,
-1.6067126989364624,
0.6271416544914246,
-0.5385614633560181,
-1.6580950021743774,
0.3170509934425354,
0.8967992067337036,
0.2791990339756012,
-0.23723426461219788,
-0.36784881353378296,
0.24326305091381073,
0.18873874843120575,
0.3360113799571991... |
javascript/reference/global_objects/object/__lookupsetter__/index.md | JavaScript - Global Objects - Object - lookupSetter - Examples - Looking up a property's setter in the standard way:
You should use the `Object.getOwnPropertyDescriptor()` API to look up a property's setter. Compared to `__lookupSetter__()`, this method allows looking up symbol properties. The `Object.getOwnPropertyDe... | [
-0.6658563613891602,
0.020720917731523514,
-0.9367764592170715,
0.3942340016365051,
0.734627902507782,
-1.0040196180343628,
0.07347217202186584,
1.0792632102966309,
-0.30957651138305664,
0.006928729824721813,
-1.2555474042892456,
0.14932958781719208,
-0.4981554448604584,
0.1552983075380325... |
javascript/reference/global_objects/object/object/index.md | JavaScript - Global Objects - Object:
The `Object()` constructor turns the input into an object. Its behavior depends on the input's type. | [
-0.6477907299995422,
-0.2648491859436035,
-1.117607593536377,
0.3751155436038971,
-0.13492923974990845,
-1.9986464977264404,
-0.23701241612434387,
0.06845248490571976,
0.3281609117984772,
-0.38674935698509216,
-1.3454838991165161,
-0.27309492230415344,
0.007149030454456806,
-0.623962640762... |
javascript/reference/global_objects/object/object/index.md | JavaScript - Global Objects - Object - Syntax:
Example:
new Object()
new Object(value)
Object()
Object(value)
Note: `Object()` can be called with or without `new`, but sometimes with different effects. See Return value. | [
0.08295408636331558,
0.07102266699075699,
-0.9799335598945618,
-0.15077650547027588,
-0.25760602951049805,
-2.276054859161377,
-0.27658429741859436,
0.7374527454376221,
0.1286909282207489,
-0.8416405916213989,
-0.5027666687965393,
0.391764372587204,
-0.11402524262666702,
-0.116703055799007... |
javascript/reference/global_objects/object/object/index.md | JavaScript - Global Objects - Object - Syntax - Parameters:
- `value` (optional): Any value. | [
0.3511662185192108,
0.33401644229888916,
-0.9002286791801453,
-0.20891046524047852,
-1.0649802684783936,
-2.1195132732391357,
0.9960753917694092,
0.6803387403488159,
0.6094435453414917,
-1.0814166069030762,
-0.7761766910552979,
0.3901151120662689,
0.35591110587120056,
0.08781199157238007,
... |
javascript/reference/global_objects/object/object/index.md | JavaScript - Global Objects - Object - Syntax - Return value:
When the `Object()` constructor itself is called or constructed, its return value is an object:
- If the value is `null` or `undefined`, it creates and returns an empty object.
- If the value is an object already, it returns the value.
- Otherwise, it retu... | [
-1.102102279663086,
-0.14239393174648285,
-0.6554629802703857,
0.8241288065910339,
-0.3227362334728241,
-1.7127639055252075,
0.4555433988571167,
0.2887248396873474,
-0.4475747346878052,
0.14477483928203583,
-0.7896310687065125,
0.025155318900942802,
-0.1406376212835312,
0.25973960757255554... |
javascript/reference/global_objects/object/object/index.md | JavaScript - Global Objects - Object - Examples - Creating a new Object:
Example:
const o = new Object();
o.foo = 42;
console.log(o);
// { foo: 42 } | [
-0.12697479128837585,
-0.2028762400150299,
-1.1929935216903687,
0.33000507950782776,
-0.6442381739616394,
-1.5567190647125244,
-0.691569983959198,
0.3006667494773865,
-0.042436860501766205,
-0.8310678601264954,
-0.061181966215372086,
-0.3959612548351288,
0.15965144336223602,
0.010293927043... |
javascript/reference/global_objects/object/object/index.md | JavaScript - Global Objects - Object - Examples - Using Object given undefined and null types:
The following examples store an empty `Object` object in `o`:
Example:
const o = new Object();
Example:
const o = new Object(undefined);
Example:
const o = new Object(null); | [
-0.2655492424964905,
-0.00908809807151556,
-1.2429795265197754,
0.643730878829956,
-0.4292716383934021,
-1.6880555152893066,
0.7911695837974548,
0.6327158808708191,
0.037043750286102295,
-0.5518291592597961,
-0.5607356429100037,
-0.4082168638706207,
0.5462008714675903,
-0.25588250160217285... |
javascript/reference/global_objects/object/object/index.md | JavaScript - Global Objects - Object - Examples - Obtaining wrapper objects for BigInt and Symbol:
The `BigInt()` and `Symbol()` constructors throw an error when called with `new`, to prevent the common mistake of creating a wrapper object instead of the primitive value. The only way to create a wrapper object for the... | [
-0.9213609099388123,
-0.10750637948513031,
-1.2164413928985596,
0.7120928168296814,
0.029756147414445877,
-1.7701160907745361,
-0.7447357177734375,
0.1507192999124527,
-0.5212117433547974,
-0.4541942775249481,
-0.5045575499534607,
-0.31277263164520264,
0.2080649733543396,
-0.42297112941741... |
javascript/reference/global_objects/object/getownpropertydescriptors/index.md | JavaScript - Global Objects - Object - getOwnPropertyDescriptors:
The `Object.getOwnPropertyDescriptors()` static method returns all own property descriptors of a given object.
Example:
const object = {
foo: 42,
};
const descriptors = Object.getOwnPropertyDescriptors(object);
console.log(descriptors.foo.writable... | [
-0.780104398727417,
-0.6175315380096436,
-1.5893943309783936,
-0.2422374039888382,
-0.5927013158798218,
-1.5168536901474,
-0.37399646639823914,
-0.08544176816940308,
0.1680949628353119,
0.22001689672470093,
-0.6696862578392029,
0.7164947390556335,
0.015021906234323978,
-0.07718449085950851... |
javascript/reference/global_objects/object/getownpropertydescriptors/index.md | JavaScript - Global Objects - Object - getOwnPropertyDescriptors - Syntax:
Example:
Object.getOwnPropertyDescriptors(obj) | [
-1.054053544998169,
0.18679772317409515,
-1.5323841571807861,
-0.6996989250183105,
-1.1838502883911133,
-1.8121812343597412,
0.052261076867580414,
0.43529012799263,
0.31792041659355164,
-0.32654625177383423,
-0.7827376127243042,
0.5203261375427246,
-0.3534814417362213,
-0.27982017397880554... |
javascript/reference/global_objects/object/getownpropertydescriptors/index.md | JavaScript - Global Objects - Object - getOwnPropertyDescriptors - Syntax - Parameters:
- `obj`: The object for which to get all own property descriptors. | [
-0.858607292175293,
0.05233418941497803,
-1.6643638610839844,
-0.3808289170265198,
-0.6842413544654846,
-1.6160311698913574,
0.15658004581928253,
-0.21255318820476532,
0.7043125033378601,
-0.3929241895675659,
-1.258852481842041,
0.7028068900108337,
-0.45562589168548584,
0.46662503480911255... |
javascript/reference/global_objects/object/getownpropertydescriptors/index.md | JavaScript - Global Objects - Object - getOwnPropertyDescriptors - Syntax - Return value:
An object containing all own property descriptors of an object. Might be an empty object, if there are no properties. | [
-0.4420624375343323,
0.027990441769361496,
-0.6483598947525024,
0.6222845315933228,
-0.7920793890953064,
-1.6361002922058105,
1.0114070177078247,
0.5593180060386658,
0.138745978474617,
-0.2470223307609558,
-0.8663398623466492,
1.2130799293518066,
-0.23485998809337616,
0.7411921620368958,
... |
javascript/reference/global_objects/object/getownpropertydescriptors/index.md | JavaScript - Global Objects - Object - getOwnPropertyDescriptors - Description:
This method permits examination of the precise description of all own properties of an object. A property in JavaScript consists of either a string-valued name or a `Symbol` and a property descriptor. Further information about property des... | [
-0.3593338429927826,
-0.10282336175441742,
-0.8909828662872314,
0.6665138006210327,
0.585101306438446,
-0.6781308054924011,
0.12686938047409058,
0.9831173419952393,
0.02926073782145977,
-0.2865522503852844,
-0.5874001383781433,
0.5171718001365662,
-0.18208914995193481,
0.04433532431721687,... |
javascript/reference/global_objects/object/getownpropertydescriptors/index.md | JavaScript - Global Objects - Object - getOwnPropertyDescriptors - Examples - Creating a shallow copy:
Whereas the `Object.assign()` method will only copy enumerable and own properties from a source object to a target object, you are able to use this method and `Object.create()` for a shallow copy between two unknown ... | [
-1.1219267845153809,
0.2886946499347687,
-0.3990510404109955,
0.33511731028556824,
-0.2593750059604645,
-1.352066993713379,
0.49776434898376465,
0.10634391754865646,
-0.21898002922534943,
-0.3123154044151306,
-0.29005399346351624,
0.2079610675573349,
0.030200647190213203,
-0.63821154832839... |
javascript/reference/global_objects/object/getownpropertydescriptors/index.md | JavaScript - Global Objects - Object - getOwnPropertyDescriptors - Examples - Creating a subclass:
A typical way of creating a subclass is to define the subclass, set its prototype to an instance of the superclass, and then define properties on that instance. This can get awkward especially for getters and setters. In... | [
-1.1786468029022217,
-0.6162633895874023,
-0.5675498843193054,
0.8120304346084595,
0.1019737496972084,
-0.9119957685470581,
-0.022870326414704323,
0.40297722816467285,
0.21658287942409515,
0.27561232447624207,
-0.8124849796295166,
0.17838455736637115,
-0.36706146597862244,
-0.3100358247756... |
javascript/reference/global_objects/object/__lookupgetter__/index.md | JavaScript - Global Objects - Object - lookupGetter:
Deprecated: This feature is no longer recommended.
Note: This feature is deprecated in favor of the `Object.getOwnPropertyDescriptor()` API. This method's behavior is only specified for web compatibility, and is not required to be implemented in any platform. It ma... | [
-0.7027849555015564,
-0.39695215225219727,
-1.4121010303497314,
-0.3559137284755707,
-0.7014917135238647,
-1.8264386653900146,
0.20630984008312225,
0.23447667062282562,
0.2172711044549942,
-0.188936248421669,
-0.7824934124946594,
0.45343390107154846,
0.03844025731086731,
0.0609467551112175... |
javascript/reference/global_objects/object/__lookupgetter__/index.md | JavaScript - Global Objects - Object - lookupGetter - Syntax:
Example:
__lookupGetter__(prop) | [
-0.35050448775291443,
-0.25102314352989197,
-1.5138646364212036,
-0.761684775352478,
-1.1013751029968262,
-2.1677956581115723,
-0.38111451268196106,
1.1894525289535522,
-0.07943162322044373,
-0.5831363201141357,
-0.5883318781852722,
0.5823461413383484,
-0.20850780606269836,
0.1738090217113... |
javascript/reference/global_objects/object/__lookupgetter__/index.md | JavaScript - Global Objects - Object - lookupGetter - Syntax - Parameters:
- `prop`: A string containing the name of the property whose getter should be returned. | [
-0.6757357716560364,
-0.5611311793327332,
-1.5245674848556519,
-0.6086617708206177,
-0.5940273404121399,
-1.9107410907745361,
-0.09155875444412231,
0.5261650085449219,
-0.3131386935710907,
-0.514074444770813,
-1.07590913772583,
0.8807896375656128,
-0.7236499190330505,
0.45464521646499634,
... |
javascript/reference/global_objects/object/__lookupgetter__/index.md | JavaScript - Global Objects - Object - lookupGetter - Syntax - Return value:
The function bound as a getter to the specified property. Returns `undefined` if no such property is found, or the property is a data property. | [
-0.8957921266555786,
0.021297147497534752,
-1.4753273725509644,
-0.06415928155183792,
-0.6378166079521179,
-1.4794281721115112,
-0.1370694935321808,
1.2377681732177734,
0.1342439204454422,
-0.21318364143371582,
-0.5705881118774414,
0.6900019645690918,
-0.3553091287612915,
0.291797965764999... |
javascript/reference/global_objects/object/__lookupgetter__/index.md | JavaScript - Global Objects - Object - lookupGetter - Description:
All objects that inherit from `Object.prototype` (that is, all except `null`-prototype objects) inherit the `__lookupGetter__()` method. If a getter has been defined for an object's property, it's not possible to reference the getter function through t... | [
-1.3292109966278076,
-0.03804086893796921,
-1.7769170999526978,
0.4152304530143738,
0.006172276567667723,
-2.090726613998413,
0.2679307460784912,
1.0303773880004883,
-0.23570170998573303,
-0.7699389457702637,
-0.6557334065437317,
0.6556743383407593,
-0.2916407883167267,
0.48686498403549194... |
javascript/reference/global_objects/object/__lookupgetter__/index.md | JavaScript - Global Objects - Object - lookupGetter - Examples - Using lookupGetter():
Example:
const obj = {
get foo() {
return Math.random() > 0.5 ? "foo" : "bar";
},
};
obj.__lookupGetter__("foo");
// [Function: get foo] | [
-0.677490770816803,
0.12443991750478745,
-1.670332431793213,
0.030831119045615196,
-0.5104914903640747,
-1.4869221448898315,
0.11645413935184479,
0.35429465770721436,
-0.38054266571998596,
-0.04928220063447952,
-0.7271845936775208,
0.3135051727294922,
-0.5750624537467957,
0.567413449287414... |
javascript/reference/global_objects/object/__lookupgetter__/index.md | JavaScript - Global Objects - Object - lookupGetter - Examples - Looking up a property's getter in the standard way:
You should use the `Object.getOwnPropertyDescriptor()` API to look up a property's getter. Compared to `__lookupGetter__()`, this method allows looking up symbol properties. The `Object.getOwnPropertyDe... | [
-0.5937697887420654,
-0.022015802562236786,
-0.9090063571929932,
0.5063087344169617,
0.5605363249778748,
-0.3470434546470642,
0.15742529928684235,
0.6550589799880981,
0.11159516125917435,
-0.38599562644958496,
-0.9046289920806885,
0.4518112242221832,
-0.625158429145813,
0.12275391817092896... |
javascript/reference/global_objects/object/__definesetter__/index.md | JavaScript - Global Objects - Object - defineSetter:
Deprecated: This feature is no longer recommended.
Note: This feature is deprecated in favor of defining setters using the object initializer syntax or the `Object.defineProperty()` API. This method's behavior is only specified for web compatibility, and is not req... | [
-0.48508384823799133,
-0.18537038564682007,
-0.733596682548523,
0.6056622862815857,
-0.47884202003479004,
-1.8837673664093018,
0.49730274081230164,
0.5532846450805664,
0.5776566863059998,
-0.057753998786211014,
-0.6036511659622192,
-0.0891616940498352,
0.6341864466667175,
-0.00433227419853... |
javascript/reference/global_objects/object/__definesetter__/index.md | JavaScript - Global Objects - Object - defineSetter - Syntax:
Example:
__defineSetter__(prop, func) | [
-0.7024779319763184,
-0.15863676369190216,
-1.3030192852020264,
-0.007343937177211046,
-0.8553574085235596,
-1.976233720779419,
-0.07145731151103973,
0.7970711588859558,
0.5274649262428284,
-0.3466216027736664,
-0.1120121031999588,
-0.04283354803919792,
0.12060313671827316,
-0.131650909781... |
javascript/reference/global_objects/object/__definesetter__/index.md | JavaScript - Global Objects - Object - defineSetter - Syntax - Parameters:
- `prop`: A string containing the name of the property that the setter `func` is bound to.
- `func`: A function to be called when there is an attempt to set the specified property. This function receives the following parameter:
- `val`: The ... | [
-1.0934613943099976,
-0.2689754366874695,
-1.1477829217910767,
0.23498114943504333,
-0.35203269124031067,
-1.7767024040222168,
0.24078840017318726,
0.48232996463775635,
0.31419309973716736,
-0.1917499303817749,
-0.7351470589637756,
0.5888607501983643,
-0.4331851601600647,
0.602686524391174... |
javascript/reference/global_objects/object/__definesetter__/index.md | JavaScript - Global Objects - Object - defineSetter - Syntax - Return value:
None (`undefined`). | [
-0.8331602215766907,
0.13284337520599365,
-1.3487296104431152,
-0.4533191919326782,
-0.7287156581878662,
-1.7232882976531982,
0.7191020846366882,
0.9122967720031738,
-0.4374695420265198,
0.2536454498767853,
-0.41493985056877136,
-0.06152841076254845,
0.11665306240320206,
0.1844231784343719... |
javascript/reference/global_objects/object/__definesetter__/index.md | JavaScript - Global Objects - Object - defineSetter - Syntax - Exceptions:
- `TypeError`: Thrown if `func` is not a function. | [
-1.009178638458252,
-0.024372000247240067,
-1.1537903547286987,
0.24560317397117615,
-0.6022403836250305,
-1.5107306241989136,
-0.32541361451148987,
1.0246663093566895,
-0.3233342468738556,
-0.388568639755249,
-0.19662964344024658,
-0.5285903811454773,
-0.047561489045619965,
-0.23070429265... |
javascript/reference/global_objects/object/__definesetter__/index.md | JavaScript - Global Objects - Object - defineSetter - Description:
All objects that inherit from `Object.prototype` (that is, all except `null`-prototype objects) inherit the `__defineSetter__()` method. This method allows a setter to be defined on a pre-existing object. This is equivalent to `Object.defineProperty(ob... | [
-1.3424266576766968,
-0.15061716735363007,
-1.269815444946289,
0.533561646938324,
-0.27736687660217285,
-2.249005079269409,
0.39678582549095154,
0.72623610496521,
0.38533177971839905,
-0.47573980689048767,
-0.7078192830085754,
0.1161760464310646,
0.14844529330730438,
0.3788403272628784,
... |
javascript/reference/global_objects/object/__definesetter__/index.md | JavaScript - Global Objects - Object - defineSetter - Examples - Using defineSetter():
Example:
const o = {};
o.__defineSetter__("value", function (val) {
this.anotherValue = val;
});
o.value = 5;
console.log(o.value); // undefined
console.log(o.anotherValue); // 5 | [
-0.04533303156495094,
0.24792860448360443,
-1.1798616647720337,
0.9894391894340515,
-0.38443970680236816,
-1.4455853700637817,
-0.12824000418186188,
0.7416470050811768,
0.19204112887382507,
-0.24248568713665009,
0.16324497759342194,
-0.38694608211517334,
0.2841898202896118,
-0.132866948843... |
javascript/reference/global_objects/object/__definesetter__/index.md | JavaScript - Global Objects - Object - defineSetter - Examples - Defining a setter property in standard ways:
You can use the `set` syntax to define a setter when the object is first initialized.
Example:
const o = {
set value(val) {
this.anotherValue = val;
},
};
o.value = 5;
console.log(o.value); // undefi... | [
-0.19091571867465973,
0.23535160720348358,
-1.0249730348587036,
1.14407217502594,
0.1549181342124939,
-1.8701393604278564,
-0.09280496835708618,
0.6870415210723877,
0.712648332118988,
0.14608070254325867,
-0.09758884459733963,
0.02222231589257717,
0.6697361469268799,
0.25307348370552063,
... |
javascript/reference/global_objects/object/preventextensions/index.md | JavaScript - Global Objects - Object - preventExtensions:
The `Object.preventExtensions()` static method prevents new properties from ever being added to an object (i.e., prevents future extensions to the object). It also prevents the object's prototype from being re-assigned.
Example:
const object = {};
Object.pre... | [
-0.7155621647834778,
-0.11624610424041748,
-0.8620604872703552,
-0.02852504886686802,
-0.4947548806667328,
-2.470583915710449,
0.41997623443603516,
1.3654024600982666,
-0.23080842196941376,
0.08406567573547363,
-1.5388438701629639,
0.12498000264167786,
-0.6030945181846619,
-0.7977086305618... |
javascript/reference/global_objects/object/preventextensions/index.md | JavaScript - Global Objects - Object - preventExtensions - Syntax:
Example:
Object.preventExtensions(obj) | [
-0.3590063452720642,
0.4125690460205078,
-0.899767279624939,
-0.8718354105949402,
-1.146730661392212,
-2.662625789642334,
0.4665285050868988,
1.251975417137146,
0.044030699878931046,
-0.5126033425331116,
-0.996904730796814,
-0.10366174578666687,
-0.8264133334159851,
-0.511811375617981,
0... |
javascript/reference/global_objects/object/preventextensions/index.md | JavaScript - Global Objects - Object - preventExtensions - Syntax - Parameters:
- `obj`: The object which should be made non-extensible. | [
-0.6927587389945984,
0.746149480342865,
-1.0695641040802002,
-0.640117347240448,
-0.6173647046089172,
-2.2221128940582275,
0.2327672690153122,
0.5556685924530029,
0.5627888441085815,
-0.04792240262031555,
-1.477535367012024,
0.13810937106609344,
-0.37013518810272217,
-0.057885944843292236,... |
javascript/reference/global_objects/object/preventextensions/index.md | JavaScript - Global Objects - Object - preventExtensions - Syntax - Return value:
The object being made non-extensible. | [
-0.21919679641723633,
0.4588048756122589,
-0.6119551062583923,
-0.5378834009170532,
-0.8661673665046692,
-2.178110361099243,
0.35100480914115906,
1.6730375289916992,
0.29301056265830994,
0.24112814664840698,
-1.1329916715621948,
0.5379617214202881,
-0.2955888509750366,
0.2890707850456238,
... |
javascript/reference/global_objects/object/preventextensions/index.md | JavaScript - Global Objects - Object - preventExtensions - Description:
An object is extensible if new properties can be added to it. `Object.preventExtensions()` marks an object as no longer extensible, so that it will never have properties beyond the ones it had at the time it was marked as non-extensible. Note that... | [
0.04661613330245018,
-0.06342002004384995,
-0.5625547170639038,
1.105340838432312,
0.34834375977516174,
-0.8261164426803589,
0.1837400645017624,
1.0166696310043335,
0.027107039466500282,
-0.2827293872833252,
-0.8683738708496094,
0.1709478348493576,
-0.5791451334953308,
-0.10635746270418167... |
javascript/reference/global_objects/object/preventextensions/index.md | JavaScript - Global Objects - Object - preventExtensions - Examples - Using Object.preventExtensions:
Example:
// Object.preventExtensions returns the object
// being made non-extensible.
const obj = {};
const obj2 = Object.preventExtensions(obj);
obj === obj2; // true
// Objects are extensible by default.
const emp... | [
-0.5037861466407776,
0.4037320613861084,
-0.4279951751232147,
0.4511842429637909,
0.16473723948001862,
-1.5438072681427002,
0.30516743659973145,
0.9397466778755188,
-0.5349036455154419,
0.3257804811000824,
-1.4695850610733032,
-0.20758064091205597,
-0.5754178166389465,
0.11424963176250458,... |
javascript/reference/global_objects/object/preventextensions/index.md | JavaScript - Global Objects - Object - preventExtensions - Examples - Non-object argument:
In ES5, if the argument to this method is not an object (a primitive), then it will cause a `TypeError`. In ES2015, a non-object argument will be returned as-is without any errors, since primitives are already, by definition, im... | [
-0.12130353599786758,
-0.18943794071674347,
-0.3636004626750946,
-0.1693485677242279,
-0.3268239498138428,
-3.1043365001678467,
0.8286481499671936,
1.3422331809997559,
0.04816211760044098,
0.16711151599884033,
-0.34156984090805054,
-0.5884296894073486,
-0.4863519072532654,
-0.6440283060073... |
javascript/reference/global_objects/object/defineproperties/index.md | JavaScript - Global Objects - Object - defineProperties:
The `Object.defineProperties()` static method defines new or modifies existing properties directly on an object, returning the object.
Example:
const object = {};
Object.defineProperties(object, {
property1: {
value: 42,
writable: true,
},
prope... | [
-0.6380748748779297,
-0.4244636297225952,
-0.9816927313804626,
0.23404772579669952,
-0.19709789752960205,
-1.6762205362319946,
0.26208293437957764,
0.4672827422618866,
0.3151587247848511,
-0.11184113472700119,
-1.2963200807571411,
0.22063755989074707,
0.44882631301879883,
-0.36102032661437... |
javascript/reference/global_objects/object/defineproperties/index.md | JavaScript - Global Objects - Object - defineProperties - Syntax:
Example:
Object.defineProperties(obj, props) | [
-0.639224648475647,
0.0640929713845253,
-0.7065253257751465,
-0.7133087515830994,
-0.902591347694397,
-1.5847078561782837,
-0.003636330831795931,
0.40316668152809143,
0.517888069152832,
-0.4355902373790741,
-1.01482355594635,
0.1465996950864792,
0.0036182869225740433,
-0.16937758028507233,... |
javascript/reference/global_objects/object/defineproperties/index.md | JavaScript - Global Objects - Object - defineProperties - Syntax - Parameters:
- `obj`: The object on which to define or modify properties.
- `props`: An object whose keys represent the names of properties to be defined or modified and whose values are objects describing those properties. Each value in `props` must be... | [
-0.454690545797348,
0.19780442118644714,
-0.827643632888794,
0.9373088479042053,
0.17571966350078583,
-0.3244437575340271,
0.3456631004810333,
0.916581928730011,
0.5162155628204346,
-0.19829142093658447,
-0.7125858664512634,
0.2462560534477234,
0.00846228376030922,
0.3184509575366974,
0.... |
javascript/reference/global_objects/object/defineproperties/index.md | JavaScript - Global Objects - Object - defineProperties - Syntax - Return value:
The object that was passed to the function. | [
-0.0513106994330883,
0.0506259985268116,
-1.0113598108291626,
-0.27925997972488403,
-0.6340000629425049,
-1.4660545587539673,
0.37741905450820923,
1.010543942451477,
0.032662130892276764,
-0.09234598278999329,
-0.9167762994766235,
0.6823077201843262,
-0.06388197094202042,
1.095402717590332... |
javascript/reference/global_objects/object/defineproperties/index.md | JavaScript - Global Objects - Object - defineProperties - Examples - Using Object.defineProperties:
Example:
const obj = {};
Object.defineProperties(obj, {
property1: {
value: true,
writable: true,
},
property2: {
value: "Hello",
writable: false,
},
// etc. etc.
}); | [
-0.6654262542724609,
0.37729692459106445,
-0.3765561580657959,
-0.04420693963766098,
-0.37758880853652954,
-1.825215220451355,
-0.2139001488685608,
0.12726113200187683,
0.39751628041267395,
-0.49270787835121155,
-0.7320106029510498,
0.12326004356145859,
0.16955731809139252,
-0.830462157726... |
javascript/reference/global_objects/object/__definegetter__/index.md | JavaScript - Global Objects - Object - defineGetter:
Deprecated: This feature is no longer recommended.
Note: This feature is deprecated in favor of defining getters using the object initializer syntax or the `Object.defineProperty()` API. This method's behavior is only specified for web compatibility, and is not req... | [
-0.232291579246521,
-0.14337338507175446,
-1.0183496475219727,
-0.014224539510905743,
-0.514123260974884,
-1.8956201076507568,
0.2578754723072052,
0.3006259500980377,
0.35016703605651855,
-0.013742403127253056,
-0.7461265921592712,
-0.19475938379764557,
0.16821883618831635,
0.0327151492238... |
javascript/reference/global_objects/object/__definegetter__/index.md | JavaScript - Global Objects - Object - defineGetter - Syntax:
Example:
__defineGetter__(prop, func) | [
-0.4086074233055115,
-0.0625205710530281,
-1.4548189640045166,
-0.5491304397583008,
-1.1673473119735718,
-2.0792906284332275,
-0.4884377419948578,
0.7763524055480957,
0.15670327842235565,
-0.30814558267593384,
-0.10430040955543518,
-0.04825801029801369,
-0.4047710597515106,
-0.034151054918... |
javascript/reference/global_objects/object/__definegetter__/index.md | JavaScript - Global Objects - Object - defineGetter - Syntax - Parameters:
- `prop`: A string containing the name of the property that the getter `func` is bound to.
- `func`: A function to be bound to a lookup of the specified property. | [
-0.978207528591156,
-0.5079827308654785,
-1.4159364700317383,
-0.566718339920044,
-0.608623743057251,
-1.907808542251587,
-0.3567938208580017,
0.5174541473388672,
0.35544511675834656,
-0.3059889078140259,
-1.04085373878479,
0.4345475137233734,
-0.8393988013267517,
0.5555097460746765,
0.1... |
javascript/reference/global_objects/object/__definegetter__/index.md | JavaScript - Global Objects - Object - defineGetter - Syntax - Return value:
None (`undefined`). | [
-0.6419081091880798,
0.31125548481941223,
-1.4575904607772827,
-1.0585249662399292,
-0.8673014640808105,
-1.6291123628616333,
0.3545568287372589,
0.7981089353561401,
-0.6182997822761536,
0.20820970833301544,
-0.4397113025188446,
-0.1023654192686081,
-0.3353642225265503,
0.23710915446281433... |
javascript/reference/global_objects/object/__definegetter__/index.md | JavaScript - Global Objects - Object - defineGetter - Syntax - Exceptions:
- `TypeError`: Thrown if `func` is not a function. | [
-0.8270255923271179,
0.023828567937016487,
-1.2157138586044312,
-0.18143194913864136,
-0.7015669941902161,
-1.574826717376709,
-0.5604926943778992,
0.9272456169128418,
-0.46499595046043396,
-0.4235702157020569,
-0.31548815965652466,
-0.5303075313568115,
-0.24230635166168213,
-0.17674410343... |
javascript/reference/global_objects/object/__definegetter__/index.md | JavaScript - Global Objects - Object - defineGetter - Description:
All objects that inherit from `Object.prototype` (that is, all except `null`-prototype objects) inherit the `__defineGetter__()` method. This method allows a getter to be defined on a pre-existing object. This is equivalent to `Object.defineProperty(ob... | [
-1.2728796005249023,
-0.23138858377933502,
-1.4329766035079956,
0.37996551394462585,
-0.34806427359580994,
-2.2832460403442383,
0.32066020369529724,
0.5461581945419312,
0.23035262525081635,
-0.5059155225753784,
-0.7397898435592651,
-0.018894821405410767,
-0.030913813039660454,
0.3492935597... |
javascript/reference/global_objects/object/__definegetter__/index.md | JavaScript - Global Objects - Object - defineGetter - Examples - Using defineGetter():
Example:
const o = {};
o.__defineGetter__("gimmeFive", function () {
return 5;
});
console.log(o.gimmeFive); // 5 | [
-0.08507222682237625,
-0.0921584963798523,
-1.51479172706604,
0.28224655985832214,
-0.21568167209625244,
-1.906482219696045,
-0.4530643820762634,
0.4242415130138397,
-0.04035590589046478,
0.23651039600372314,
-0.27269089221954346,
-0.1944732964038849,
-0.790477991104126,
-0.044560972601175... |
javascript/reference/global_objects/object/__definegetter__/index.md | JavaScript - Global Objects - Object - defineGetter - Examples - Defining a getter property in standard ways:
You can use the `get` syntax to define a getter when the object is first initialized.
Example:
const o = {
get gimmeFive() {
return 5;
},
};
console.log(o.gimmeFive); // 5
You may also use `Object.d... | [
-0.28656938672065735,
0.2379620373249054,
-0.7247398495674133,
0.2533217966556549,
0.2110983431339264,
-2.3184127807617188,
-0.06473338603973389,
0.6898312568664551,
0.20805104076862335,
0.48216164112091064,
-0.39115747809410095,
-0.2769801616668701,
-0.6670745015144348,
0.0419273376464843... |
javascript/reference/global_objects/object/valueof/index.md | JavaScript - Global Objects - Object - valueOf:
The `valueOf()` method of `Object` instances converts the `this` value to an object. This method is meant to be overridden by derived objects for custom type conversion logic.
Example:
function MyNumberType(n) {
this.number = n;
}
MyNumberType.prototype.valueOf = fu... | [
-0.07930832356214523,
-0.5285478830337524,
-0.42638155817985535,
0.24500931799411774,
0.0038664445746690035,
-1.3707669973373413,
-0.31142646074295044,
0.39462628960609436,
0.11851752549409866,
-0.38768497109413147,
-1.069875717163086,
0.08215723186731339,
-0.00976288691163063,
0.502810776... |
javascript/reference/global_objects/object/valueof/index.md | JavaScript - Global Objects - Object - valueOf - Syntax:
Example:
valueOf() | [
0.18230371177196503,
-0.09125372767448425,
-0.591367244720459,
-0.3781670033931732,
-0.4931870400905609,
-1.6248735189437866,
0.742200493812561,
1.0138378143310547,
0.3781201243400574,
-1.0427100658416748,
-0.5619086623191833,
0.47187110781669617,
-0.2357555329799652,
0.27790936827659607,
... |
javascript/reference/global_objects/object/valueof/index.md | JavaScript - Global Objects - Object - valueOf - Syntax - Parameters:
None. | [
0.028861304745078087,
0.2956489026546478,
-1.0174161195755005,
-0.6084980964660645,
-0.6072791218757629,
-1.2893266677856445,
1.0154520273208618,
1.0346392393112183,
-0.10718267410993576,
-1.1247929334640503,
-0.8755152225494385,
-0.39700889587402344,
-0.13859084248542786,
0.19821764528751... |
javascript/reference/global_objects/object/valueof/index.md | JavaScript - Global Objects - Object - valueOf - Syntax - Return value:
The `this` value, converted to an object.
Note: In order for `valueOf` to be useful during type conversion, it must return a primitive. Because all primitive types have their own `valueOf()` methods, calling `primitiveValue.valueOf()` generally d... | [
-0.14340519905090332,
0.22112759947776794,
-0.2849847078323364,
0.08420412987470627,
-0.5497772097587585,
-1.1154717206954956,
0.8878785371780396,
1.2074052095413208,
0.28244203329086304,
-0.6774980425834656,
-1.0697143077850342,
0.6594856977462769,
-0.048215508460998535,
0.560368597507476... |
javascript/reference/global_objects/object/valueof/index.md | JavaScript - Global Objects - Object - valueOf - Description:
JavaScript calls the `valueOf` method to convert an object to a primitive value. You rarely need to invoke the `valueOf` method yourself; JavaScript automatically invokes it when encountering an object where a primitive value is expected.
This method is ca... | [
-0.5444155335426331,
-0.08801808208227158,
-0.6914782524108887,
0.6455496549606323,
0.08770188689231873,
-1.2358341217041016,
1.0873433351516724,
-0.2698582708835602,
-0.32888707518577576,
-0.23388877511024475,
-0.6495168805122375,
0.20753857493400574,
-0.3880944848060608,
0.37418508529663... |
javascript/reference/global_objects/object/valueof/index.md | JavaScript - Global Objects - Object - valueOf - Examples - Using valueOf():
The base `valueOf()` method returns the `this` value itself, converted to an object if it isn't already. Therefore its return value will never be used by any primitive conversion algorithm.
Example:
const obj = { foo: 1 };
console.log(obj.v... | [
-0.3843557834625244,
0.21691416203975677,
-1.072554349899292,
0.24935905635356903,
-0.6380961537361145,
-1.2639927864074707,
1.1575440168380737,
0.5749390125274658,
-0.06345798075199127,
-0.41240155696868896,
-0.9894521236419678,
0.3994152545928955,
0.28641119599342346,
0.08341825753450394... |
javascript/reference/global_objects/object/valueof/index.md | JavaScript - Global Objects - Object - valueOf - Examples - Overriding valueOf for custom objects:
You can create a function to be called in place of the default `valueOf` method. Your function should take no arguments, since it won't be passed any when called during type conversion.
For example, you can add a `value... | [
0.5863527655601501,
-0.33474045991897583,
-0.6165977120399475,
1.2853573560714722,
0.5181095600128174,
-1.6774743795394897,
0.38588690757751465,
0.28935399651527405,
-0.49141067266464233,
-0.8560401797294617,
-0.45671167969703674,
-0.15543067455291748,
-0.15256458520889282,
0.4355282485485... |
javascript/reference/global_objects/object/valueof/index.md | JavaScript - Global Objects - Object - valueOf - Examples - Using unary plus on objects:
Unary plus performs number coercion on its operand, which, for most objects without `[Symbol.toPrimitive]()`, means calling its `valueOf()`. However, if the object doesn't have a custom `valueOf()` method, the base implementation ... | [
-0.6109801530838013,
0.3081803321838379,
-0.849320113658905,
0.37518495321273804,
-0.151908278465271,
-1.1045743227005005,
0.08150627464056015,
0.5561186075210571,
-0.8117353916168213,
-0.4742165207862854,
-1.4014246463775635,
-0.29125094413757324,
-0.5700545907020569,
-0.2767654359340668,... |
javascript/reference/global_objects/object/groupby/index.md | JavaScript - Global Objects - Object - groupBy:
Note: In some versions of some browsers, this method was implemented as the method `Array.prototype.group()`. Due to web compatibility issues, it is now implemented as a static method. Check the browser compatibility table for details.
The `Object.groupBy()` static meth... | [
-0.08238285034894943,
-0.17346961796283722,
-0.6842672824859619,
0.944642961025238,
0.4268258810043335,
-0.7923015356063843,
0.9611066579818726,
0.04800640791654587,
-0.545640230178833,
0.7109556794166565,
-0.31741079688072205,
-0.1571653187274933,
0.0053652613423764706,
0.4800271093845367... |
javascript/reference/global_objects/object/groupby/index.md | JavaScript - Global Objects - Object - groupBy - Syntax:
Example:
Object.groupBy(items, callbackFn) | [
0.08480324596166611,
0.33714163303375244,
-0.9293999075889587,
0.03897977992892265,
-0.8192991614341736,
-1.834830641746521,
0.32871127128601074,
-0.498715877532959,
-1.1162687540054321,
-0.0647290050983429,
-0.989079475402832,
0.24405242502689362,
-0.2625776529312134,
0.5294761657714844,
... |
javascript/reference/global_objects/object/groupby/index.md | JavaScript - Global Objects - Object - groupBy - Syntax - Parameters:
- `items`: An iterable (such as an `Array`) whose elements will be grouped.
- `callbackFn`: A function to execute for each element in the iterable. It should return a value that can get coerced into a property key (string or symbol) indicating the g... | [
-0.06302773952484131,
0.21338412165641785,
-0.9275328516960144,
0.3857659697532654,
-0.24393856525421143,
-1.85444176197052,
0.32168400287628174,
-0.3183959722518921,
-0.9380767941474915,
0.6680955290794373,
-1.3175809383392334,
0.35439854860305786,
-0.790090799331665,
1.1167736053466797,
... |
javascript/reference/global_objects/object/groupby/index.md | JavaScript - Global Objects - Object - groupBy - Syntax - Return value:
A `null`-prototype object with properties for all groups, each assigned to an array containing the elements of the associated group. | [
-0.5615294575691223,
0.11575087904930115,
-0.35216957330703735,
0.34979143738746643,
-0.6361982822418213,
-1.572948932647705,
1.0538485050201416,
0.6283645629882812,
-0.354265958070755,
0.11454406380653381,
-0.9172366261482239,
0.8963951468467712,
0.1817701905965805,
0.5703815817832947,
... |
javascript/reference/global_objects/object/groupby/index.md | JavaScript - Global Objects - Object - groupBy - Description:
`Object.groupBy()` calls a provided `callbackFn` function once for each element in an iterable. The callback function should return a string or symbol (values that are neither type are coerced to strings) indicating the group of the associated element. The ... | [
-0.7001758217811584,
0.3022049069404602,
-1.4515875577926636,
0.20916573703289032,
-0.24926549196243286,
-1.678061842918396,
1.0834732055664062,
-0.9918493628501892,
-1.7819066047668457,
0.6328091621398926,
-0.6248620748519897,
0.5038843750953674,
-0.3300808370113373,
0.6899769902229309,
... |
javascript/reference/global_objects/object/groupby/index.md | JavaScript - Global Objects - Object - groupBy - Examples - Using Object.groupBy():
First we define an array containing objects representing an inventory of different foodstuffs. Each food has a `type` and a `quantity`.
Example:
const inventory = [
{ name: "asparagus", type: "vegetables", quantity: 5 },
{ name: ... | [
0.09446047991514206,
0.04263458400964737,
-0.629052996635437,
1.0855015516281128,
0.3098156452178955,
-0.6355355978012085,
0.12326940149068832,
0.674712061882019,
-0.6803117990493774,
-0.206812784075737,
-0.2860645055770874,
-0.12877728044986725,
-0.4805109202861786,
0.24000996351242065,
... |
javascript/reference/global_objects/object/seal/index.md | JavaScript - Global Objects - Object - seal:
The `Object.seal()` static method seals an object. Sealing an object prevents extensions and makes existing properties non-configurable. A sealed object has a fixed set of properties: new properties cannot be added, existing properties cannot be removed, their enumerability... | [
-1.1771163940429688,
0.2687193751335144,
-1.301637053489685,
-0.06934056431055069,
0.08557397872209549,
-1.814435362815857,
-0.14094969630241394,
1.1624634265899658,
-0.5037980675697327,
0.3930433392524719,
-0.10072657465934753,
0.3711607754230499,
0.17906352877616882,
0.04963527247309685,... |
javascript/reference/global_objects/object/seal/index.md | JavaScript - Global Objects - Object - seal - Syntax:
Example:
Object.seal(obj) | [
-0.8993250131607056,
0.5818036794662476,
-1.4007904529571533,
-0.811798095703125,
-0.6611078977584839,
-1.779661774635315,
0.11070573329925537,
1.1799988746643066,
-0.45782360434532166,
-0.2952425181865692,
0.16205601394176483,
0.5414397716522217,
-0.13770471513271332,
0.20242102444171906,... |
javascript/reference/global_objects/object/seal/index.md | JavaScript - Global Objects - Object - seal - Syntax - Parameters:
- `obj`: The object which should be sealed. | [
-0.740340530872345,
0.8703078627586365,
-1.3422274589538574,
-0.8249968886375427,
-0.45641767978668213,
-1.8402791023254395,
-0.5619458556175232,
0.5113282203674316,
-0.14414559304714203,
0.07274527847766876,
-0.5065498948097229,
0.5393901467323303,
-0.23455820977687836,
0.7982736229896545... |
javascript/reference/global_objects/object/seal/index.md | JavaScript - Global Objects - Object - seal - Syntax - Return value:
The object being sealed. | [
-0.5759404301643372,
0.6627084016799927,
-1.1214340925216675,
-0.6559056639671326,
-0.6342564225196838,
-1.416731595993042,
-0.350686252117157,
1.6535964012145996,
-0.3970922827720642,
0.09482013434171677,
-0.1387963443994522,
0.8767849206924438,
-0.22913280129432678,
1.0312613248825073,
... |
javascript/reference/global_objects/object/seal/index.md | JavaScript - Global Objects - Object - seal - Description:
Sealing an object is equivalent to preventing extensions and then changing all existing properties' descriptors to `configurable: false`. This has the effect of making the set of properties on the object fixed. Making all properties non-configurable also preve... | [
-1.3244171142578125,
0.4301881492137909,
-1.0918599367141724,
0.09501318633556366,
-0.35459423065185547,
-1.613207459449768,
0.02362251654267311,
1.2316508293151855,
-0.03907160460948944,
-0.13370251655578613,
-0.5174371004104614,
0.23151010274887085,
-0.21463671326637268,
-0.3241201937198... |
javascript/reference/global_objects/object/seal/index.md | JavaScript - Global Objects - Object - seal - Examples - Using Object.seal:
Example:
const obj = {
prop() {},
foo: "bar",
};
// New properties may be added, existing properties
// may be changed or removed.
obj.foo = "baz";
obj.lumpy = "woof";
delete obj.prop;
const o = Object.seal(obj);
o === obj; // true
Obj... | [
-0.266321063041687,
0.34194332361221313,
-0.6947181820869446,
0.048447854816913605,
-0.04493607208132744,
-0.30350786447525024,
0.009798151440918446,
0.30318039655685425,
-0.25500690937042236,
-0.495155930519104,
-0.7150965332984924,
0.1325773298740387,
-0.26805195212364197,
0.084244243800... |
javascript/reference/global_objects/object/seal/index.md | JavaScript - Global Objects - Object - seal - Examples - Non-object argument:
In ES5, if the argument to this method is not an object (a primitive), then it will cause a `TypeError`. In ES2015, a non-object argument will be returned as-is without any errors, since primitives are already, by definition, immutable.
Exa... | [
-0.5950034856796265,
-0.014652861282229424,
-0.5464309453964233,
-0.029158208519220352,
-0.06929503381252289,
-2.766294002532959,
0.6206746697425842,
1.533290982246399,
-0.31609049439430237,
0.2839387059211731,
0.2191362977027893,
-0.5313425660133362,
-0.009297707118093967,
-0.259669274091... |
javascript/reference/global_objects/object/hasown/index.md | JavaScript - Global Objects - Object - hasOwn:
The `Object.hasOwn()` static method returns `true` if the specified object has the indicated property as its own property. If the property is inherited, or does not exist, the method returns `false`.
Note: `Object.hasOwn()` is intended as a replacement for `Object.protot... | [
-0.9375401735305786,
-0.20444412529468536,
-0.8122563362121582,
0.23859430849552155,
-0.1704416126012802,
-2.10275936126709,
0.1945287436246872,
0.4090178310871124,
-0.2993556559085846,
0.5207902789115906,
-0.8796584010124207,
0.19543981552124023,
-0.13754481077194214,
-0.4756443202495575,... |
javascript/reference/global_objects/object/hasown/index.md | JavaScript - Global Objects - Object - hasOwn - Syntax:
Example:
Object.hasOwn(obj, prop) | [
0.009886210784316063,
0.3242524564266205,
-1.1359318494796753,
-0.5628970861434937,
-0.7197908759117126,
-1.834080696105957,
0.025956930592656136,
0.38020992279052734,
-0.29151907563209534,
-0.10011256486177444,
-0.9636487364768982,
0.30258306860923767,
-0.5402514934539795,
-0.355118989944... |
javascript/reference/global_objects/object/hasown/index.md | JavaScript - Global Objects - Object - hasOwn - Syntax - Parameters:
- `obj`: The JavaScript object instance to test.
- `prop`: The `String` name or Symbol of the property to test. | [
-0.48675936460494995,
-0.44621285796165466,
-0.8390980958938599,
-0.26142728328704834,
-0.04776833578944206,
-1.9243983030319214,
0.10165264457464218,
-0.2696376442909241,
-0.3060291111469269,
0.13533923029899597,
-1.2957377433776855,
0.35843124985694885,
-0.47220322489738464,
0.0228205677... |
javascript/reference/global_objects/object/hasown/index.md | JavaScript - Global Objects - Object - hasOwn - Syntax - Return value:
`true` if the specified object has directly defined the specified property. Otherwise `false` | [
-0.8621509671211243,
-0.0852668508887291,
-0.6826590895652771,
0.176443412899971,
-0.8385723233222961,
-2.2483277320861816,
0.767095148563385,
0.184187650680542,
-0.5442014932632446,
0.28208020329475403,
-0.9450480937957764,
0.2087850272655487,
0.1272445023059845,
0.02551707811653614,
0.... |
javascript/reference/global_objects/object/hasown/index.md | JavaScript - Global Objects - Object - hasOwn - Description:
The `Object.hasOwn()` method returns `true` if the specified property is a direct property of the object — even if the property value is `null` or `undefined`. The method returns `false` if the property is inherited, or has not been declared at all. Unlike t... | [
-0.7562557458877563,
0.1420440673828125,
-1.1613723039627075,
0.48792365193367004,
-0.07960010319948196,
-1.8094416856765747,
0.6809917688369751,
0.26220399141311646,
-0.4374416768550873,
0.46526089310646057,
-1.224516749382019,
0.390899121761322,
0.3130035996437073,
-0.40260788798332214,
... |
javascript/reference/global_objects/object/hasown/index.md | JavaScript - Global Objects - Object - hasOwn - Examples - Using Object.hasOwn() to test for a property's existence:
The following code shows how to determine whether the `example` object contains a property named `prop`.
Example:
const example = {};
Object.hasOwn(example, "prop"); // false - 'prop' has not been def... | [
-1.0444064140319824,
-0.08724286407232285,
-0.6068698167800903,
0.15346458554267883,
-0.460653156042099,
-1.6425280570983887,
0.6999738216400146,
0.3980422616004944,
-0.14539124071598053,
0.4838651716709137,
-1.122437596321106,
0.294437438249588,
-0.7989400625228882,
-0.3412390947341919,
... |
javascript/reference/global_objects/object/hasown/index.md | JavaScript - Global Objects - Object - hasOwn - Examples - Direct vs. inherited properties:
The following example differentiates between direct properties and properties inherited through the prototype chain:
Example:
const example = {};
example.prop = "exists";
// `hasOwn` will only return true for direct properti... | [
-0.5457322001457214,
0.017691614106297493,
-0.15308086574077606,
0.13210022449493408,
-0.40893247723579407,
-2.369687795639038,
0.13143430650234222,
0.7843455076217651,
0.18643799424171448,
0.24203667044639587,
-0.5344988107681274,
0.3184012174606323,
-0.7835462093353271,
-0.51013731956481... |
javascript/reference/global_objects/object/hasown/index.md | JavaScript - Global Objects - Object - hasOwn - Examples - Iterating over the properties of an object:
To iterate over the enumerable properties of an object, you should use:
Example:
const example = { foo: true, bar: true };
for (const name of Object.keys(example)) {
// …
}
But if you need to use `for...in`, you... | [
-0.22483594715595245,
0.21629656851291656,
-0.05493540316820145,
0.9819625020027161,
-0.09315867722034454,
-2.7317378520965576,
0.4200206696987152,
0.11506359279155731,
-0.8594905138015747,
-0.20597174763679504,
-0.3917189836502075,
0.46069324016571045,
-0.3388272821903229,
-0.306019097566... |
javascript/reference/global_objects/object/hasown/index.md | JavaScript - Global Objects - Object - hasOwn - Examples - Checking if an Array index exists:
The elements of an `Array` are defined as direct properties, so you can use `hasOwn()` method to check whether a particular index exists:
Example:
const fruits = ["Apple", "Banana", "Watermelon", "Orange"];
Object.hasOwn(fr... | [
-0.5416584014892578,
-0.3640230596065521,
-0.7867051362991333,
0.6431414484977722,
-0.4407879412174225,
-1.0746814012527466,
0.7727704048156738,
0.3746194839477539,
-0.29515916109085083,
0.2934200167655945,
-0.45505252480506897,
-0.5856422781944275,
-0.5678477883338928,
-0.1098969802260398... |
javascript/reference/global_objects/object/hasown/index.md | JavaScript - Global Objects - Object - hasOwn - Examples - Problematic cases for hasOwnProperty():
This section demonstrates that `Object.hasOwn()` is immune to the problems that affect `hasOwnProperty()`. Firstly, it can be used with objects that have re-implemented `hasOwnProperty()`. In the example below, the re-im... | [
0.09847954660654068,
0.21867500245571136,
-0.40343087911605835,
0.6642410159111023,
0.5629299879074097,
-1.1543012857437134,
0.16143471002578735,
0.7735520601272583,
-0.49466320872306824,
0.4387185275554657,
-1.149525761604309,
0.36505553126335144,
-0.35447150468826294,
-0.1497485190629959... |
javascript/reference/global_objects/object/isextensible/index.md | JavaScript - Global Objects - Object - isExtensible:
The `Object.isExtensible()` static method determines if an object is extensible (whether it can have new properties added to it).
Example:
const object = {};
console.log(Object.isExtensible(object));
// Expected output: true
Object.preventExtensions(object);
co... | [
-1.375526785850525,
-0.8343271017074585,
-0.6085557341575623,
0.43648743629455566,
-0.35527095198631287,
-2.4588301181793213,
0.4441840648651123,
0.4577491581439972,
0.3216996490955353,
-0.15990902483463287,
-1.3099929094314575,
0.21162548661231995,
-0.0889853984117508,
-0.2144886255264282... |
javascript/reference/global_objects/object/isextensible/index.md | JavaScript - Global Objects - Object - isExtensible - Syntax:
Example:
Object.isExtensible(obj) | [
-0.6775039434432983,
0.007900255732238293,
-0.8149349689483643,
-0.24160136282444,
-0.7944694757461548,
-2.392683267593384,
0.6057038903236389,
0.649566650390625,
0.16782818734645844,
-0.9271669387817383,
-0.9164427518844604,
0.381609171628952,
-0.40235739946365356,
-0.20272330939769745,
... |
javascript/reference/global_objects/object/isextensible/index.md | JavaScript - Global Objects - Object - isExtensible - Syntax - Parameters:
- `obj`: The object which should be checked. | [
-0.6352249383926392,
0.24012266099452972,
-1.1209404468536377,
-0.4176855683326721,
-0.3579487204551697,
-1.6795940399169922,
0.4867892265319824,
-0.2542901039123535,
0.16761614382266998,
-0.06418269127607346,
-1.5123590230941772,
0.2990628480911255,
-0.3981187343597412,
0.6516364216804504... |
javascript/reference/global_objects/object/isextensible/index.md | JavaScript - Global Objects - Object - isExtensible - Syntax - Return value:
A `Boolean` indicating whether or not the given object is extensible. | [
-1.0754673480987549,
-0.34810924530029297,
-0.5415555238723755,
0.06353794038295746,
-0.8588372468948364,
-1.9441806077957153,
0.7669738531112671,
0.9321517944335938,
0.23482030630111694,
-0.589687168598175,
-1.206540584564209,
1.1561893224716187,
-0.17418141663074493,
0.53892582654953,
... |
javascript/reference/global_objects/object/isextensible/index.md | JavaScript - Global Objects - Object - isExtensible - Description:
Objects are extensible by default: they can have new properties added to them, and their `[[Prototype]]` can be re-assigned. An object can be marked as non-extensible using one of `Object.preventExtensions()`, `Object.seal()`, `Object.freeze()`, or `Re... | [
-1.6414982080459595,
-0.310597687959671,
-0.614561915397644,
0.17149001359939575,
-0.2593259811401367,
-2.184596061706543,
0.3920285403728485,
1.1212037801742554,
0.16945677995681763,
-0.48856717348098755,
-1.2412488460540771,
0.4950001537799835,
-0.14268037676811218,
-0.07689022272825241,... |
javascript/reference/global_objects/object/isextensible/index.md | JavaScript - Global Objects - Object - isExtensible - Examples - Using Object.isExtensible:
Example:
// New objects are extensible.
const empty = {};
Object.isExtensible(empty); // true
// They can be made un-extensible
Object.preventExtensions(empty);
Object.isExtensible(empty); // false
// Sealed objects are by d... | [
-0.9557584524154663,
-0.012693230994045734,
-0.6030084490776062,
0.09180593490600586,
-0.31393155455589294,
-2.707720994949341,
0.07504867017269135,
0.6367517709732056,
0.04334646090865135,
-0.2770843207836151,
-0.8633355498313904,
0.2498503178358078,
-0.480181485414505,
0.0153360785916447... |
javascript/reference/global_objects/object/isextensible/index.md | JavaScript - Global Objects - Object - isExtensible - Examples - Non-object argument:
In ES5, if the argument to this method is not an object (a primitive), then it will cause a `TypeError`. In ES2015, it will return `false` without any errors if a non-object argument is passed, since primitives are, by definition, im... | [
-0.45160385966300964,
-0.4385411739349365,
-0.32347336411476135,
0.03569813445210457,
-0.16850340366363525,
-2.94813871383667,
0.9509699940681458,
0.8746082186698914,
-0.05295156314969063,
0.058390062302351,
-0.3783119320869446,
-0.44723033905029297,
-0.21536025404930115,
-0.37900644540786... |
javascript/reference/global_objects/object/getownpropertynames/index.md | JavaScript - Global Objects - Object - getOwnPropertyNames:
The `Object.getOwnPropertyNames()` static method returns an array of all properties (including non-enumerable properties except for those which use Symbol) found directly in a given object.
Example:
const object = {
a: 1,
b: 2,
c: 3,
};
console.log(O... | [
-0.6801596283912659,
-0.15621116757392883,
-1.7407739162445068,
0.003943165764212608,
-0.335869163274765,
-1.4388765096664429,
0.3968105614185333,
0.26458626985549927,
-0.2219843566417694,
-0.05030255392193794,
-0.7585380673408508,
0.7783978581428528,
-0.15636374056339264,
-0.3304520249366... |
javascript/reference/global_objects/object/getownpropertynames/index.md | JavaScript - Global Objects - Object - getOwnPropertyNames - Syntax:
Example:
Object.getOwnPropertyNames(obj) | [
-0.7971174716949463,
0.32903411984443665,
-1.5563998222351074,
-0.6129745841026306,
-0.9895766973495483,
-1.8380529880523682,
0.2700578272342682,
0.4182372987270355,
-0.12940821051597595,
-0.378263384103775,
-0.8020129799842834,
0.5295723676681519,
-0.753544807434082,
-0.46907559037208557,... |
javascript/reference/global_objects/object/getownpropertynames/index.md | JavaScript - Global Objects - Object - getOwnPropertyNames - Syntax - Parameters:
- `obj`: The object whose enumerable and non-enumerable properties are to be returned. | [
-0.7936431765556335,
0.5608214735984802,
-0.9974055290222168,
-0.336643785238266,
-0.7892670631408691,
-1.3424146175384521,
0.6888573169708252,
0.08693253248929977,
-0.11255048215389252,
-0.25764814019203186,
-1.2354519367218018,
0.8860570788383484,
-0.22068822383880615,
0.4809728860855102... |
javascript/reference/global_objects/object/getownpropertynames/index.md | JavaScript - Global Objects - Object - getOwnPropertyNames - Syntax - Return value:
An array of strings that corresponds to the properties found directly in the given object. | [
-0.43678632378578186,
0.14831413328647614,
-0.6811655759811401,
0.11092426627874374,
-0.6707669496536255,
-1.701877474784851,
0.7676626443862915,
0.7683518528938293,
-0.2675354480743408,
-0.1321357637643814,
-0.9514656662940979,
1.0758357048034668,
-0.8603647351264954,
0.7652532458305359,
... |
javascript/reference/global_objects/object/getownpropertynames/index.md | JavaScript - Global Objects - Object - getOwnPropertyNames - Description:
`Object.getOwnPropertyNames()` returns an array whose elements are strings corresponding to the enumerable and non-enumerable properties found directly in a given object `obj`. The ordering of the enumerable properties in the array is consistent... | [
-0.5813335180282593,
-0.46485501527786255,
-1.085245966911316,
0.2607139050960541,
0.06956128776073456,
-1.6741033792495728,
0.5944531559944153,
-0.16396325826644897,
-0.6029888987541199,
0.5593799352645874,
-0.4937252998352051,
0.24954508244991302,
-0.5319227576255798,
-0.0826528742909431... |
javascript/reference/global_objects/object/getownpropertynames/index.md | JavaScript - Global Objects - Object - getOwnPropertyNames - Examples - Using Object.getOwnPropertyNames():
Example:
const arr = ["a", "b", "c"];
console.log(Object.getOwnPropertyNames(arr).sort());
// ["0", "1", "2", "length"]
// Array-like object
const obj = { 0: "a", 1: "b", 2: "c" };
console.log(Object.getOwnPro... | [
-0.2334206998348236,
-0.0833461806178093,
-0.5262887477874756,
-0.10374023020267487,
0.45313480496406555,
-0.6006904244422913,
0.05200892314314842,
0.5850088000297546,
-0.5458112955093384,
0.07462085038423538,
-0.8978937268257141,
0.39068982005119324,
-0.786484956741333,
0.1179260239005088... |
javascript/reference/global_objects/object/getownpropertynames/index.md | JavaScript - Global Objects - Object - getOwnPropertyNames - Examples - Get non-enumerable properties only:
This uses the `Array.prototype.filter()` function to remove the enumerable keys (obtained with `Object.keys()`) from a list of all keys (obtained with `Object.getOwnPropertyNames()`) thus giving only the non-enu... | [
-0.8998348712921143,
-0.08772853761911392,
-1.1521196365356445,
-0.305006206035614,
-0.5137662887573242,
-1.811782956123352,
-0.0049653686583042145,
0.24646888673305511,
-0.653526782989502,
0.9455440044403076,
-0.4891343414783478,
-0.07154884189367294,
-0.5866659879684448,
-0.3762351870536... |
javascript/reference/global_objects/object/values/index.md | JavaScript - Global Objects - Object - values:
The `Object.values()` static method returns an array of a given object's own enumerable string-keyed property values.
Example:
const object = {
a: "some string",
b: 42,
c: false,
};
console.log(Object.values(object));
// Expected output: Array ["some string", 42,... | [
-0.6605353951454163,
-0.4450036585330963,
-1.3776895999908447,
0.2046002447605133,
-0.08850616961717606,
-1.7635167837142944,
0.27942538261413574,
0.4994484484195709,
-0.22427673637866974,
-0.2005418837070465,
-0.3693898022174835,
0.5623951554298401,
0.5262828469276428,
-0.2539092004299164... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.