file stringlengths 16 94 | text stringlengths 32 24.4k | vector list |
|---|---|---|
javascript/reference/global_objects/object/setprototypeof/index.md | JavaScript - Global Objects - Object - setPrototypeOf - Syntax - Exceptions:
- `TypeError`: Thrown in one of the following cases:
- The `obj` parameter is `undefined` or `null`.
- The `obj` parameter is non-extensible, or it's an immutable prototype exotic object, such as `Object.prototype` or `window`. However, t... | [
-1.6039363145828247,
0.10481280833482742,
-0.821262001991272,
0.23038141429424286,
-0.15635265409946442,
-1.2832413911819458,
-0.3062654435634613,
0.705426812171936,
0.25916919112205505,
-0.18031570315361023,
-0.47970855236053467,
-0.012095844373106956,
0.16524001955986023,
0.1190854012966... |
javascript/reference/global_objects/object/setprototypeof/index.md | JavaScript - Global Objects - Object - setPrototypeOf - Description:
`Object.setPrototypeOf()` is generally considered the proper way to set the prototype of an object. You should always use it in favor of the deprecated `Object.prototype.__proto__` accessor.
If the `obj` parameter is not an object (e.g., number, str... | [
-0.7953203320503235,
0.2402748316526413,
-0.10564950108528137,
0.6417737007141113,
0.1270524114370346,
-0.8218442797660828,
0.7065335512161255,
0.7101995348930359,
0.16425110399723053,
0.2919406592845917,
-1.2890818119049072,
0.12827593088150024,
0.293538361787796,
0.00831112451851368,
0... |
javascript/reference/global_objects/object/setprototypeof/index.md | JavaScript - Global Objects - Object - setPrototypeOf - Examples - Pseudoclassical inheritance using Object.setPrototypeOf():
Inheritance in JS using classes.
Example:
class Human {}
class SuperHero extends Human {}
const superMan = new SuperHero();
However, if we want to implement subclasses without using `class`... | [
-0.12518741190433502,
-0.2443305104970932,
-0.6603009700775146,
0.9096245169639587,
1.068809151649475,
-0.852643609046936,
0.29122844338417053,
1.1802263259887695,
-0.11905180662870407,
-0.354669451713562,
-0.7676855325698853,
0.2548597455024719,
-0.04082738235592842,
0.4154687523841858,
... |
javascript/reference/global_objects/object/hasownproperty/index.md | JavaScript - Global Objects - Object - hasOwnProperty:
The `hasOwnProperty()` method of `Object` instances returns a boolean indicating whether this object has the specified property as its own property (as opposed to inheriting it).
Note: `Object.hasOwn()` is recommended over `hasOwnProperty()`, in browsers where it... | [
-0.8943964838981628,
-0.46316227316856384,
-1.3106862306594849,
0.48848381638526917,
-0.4714421331882477,
-1.8177745342254639,
0.3754333257675171,
0.27569445967674255,
-0.18956358730793,
-0.06845282018184662,
-1.062270998954773,
0.5989750623703003,
0.1531149297952652,
-0.30811607837677,
... |
javascript/reference/global_objects/object/hasownproperty/index.md | JavaScript - Global Objects - Object - hasOwnProperty - Syntax:
Example:
hasOwnProperty(prop) | [
-0.4509616494178772,
0.3983924090862274,
-0.982404351234436,
-0.3879786729812622,
-0.9402540922164917,
-1.6754459142684937,
0.262626975774765,
0.7721342444419861,
-0.14307118952274323,
0.005944231059402227,
-1.054955005645752,
0.847353994846344,
-0.29005223512649536,
-0.5888268947601318,
... |
javascript/reference/global_objects/object/hasownproperty/index.md | JavaScript - Global Objects - Object - hasOwnProperty - Syntax - Parameters:
- `prop`: The `String` name or Symbol of the property to test. | [
-0.6805152297019958,
-0.2844095230102539,
-0.6487031579017639,
-0.674174427986145,
-0.3497077226638794,
-2.105576515197754,
0.07378719747066498,
0.6577287316322327,
0.19726407527923584,
-0.20177243649959564,
-1.4723504781723022,
0.8625300526618958,
-0.36380237340927124,
-0.0110059222206473... |
javascript/reference/global_objects/object/hasownproperty/index.md | JavaScript - Global Objects - Object - hasOwnProperty - Syntax - Return value:
Returns `true` if the object has the specified property as own property; `false` otherwise. | [
-0.6277740597724915,
0.2009456753730774,
-0.7591730952262878,
0.3803105056285858,
-0.8385235667228699,
-1.731723666191101,
0.8739020824432373,
0.8038353323936462,
-0.46029436588287354,
0.0797271803021431,
-1.1687952280044556,
0.5321717262268066,
0.12680159509181976,
-0.062065619975328445,
... |
javascript/reference/global_objects/object/hasownproperty/index.md | JavaScript - Global Objects - Object - hasOwnProperty - Description:
The `hasOwnProperty()` method returns `true` if the specified property is a direct property of the object — even if the value is `null` or `undefined`. The method returns `false` if the property is inherited, or has not been declared at all. Unlike t... | [
-1.2181917428970337,
-0.042913660407066345,
-0.8547486662864685,
0.7537649869918823,
-0.09788402915000916,
-1.3786091804504395,
0.991145133972168,
0.4562126696109772,
-0.6737908720970154,
-0.01783888041973114,
-0.827595055103302,
0.5116825699806213,
-0.04033311456441879,
-0.207642644643783... |
javascript/reference/global_objects/object/hasownproperty/index.md | JavaScript - Global Objects - Object - hasOwnProperty - Examples - Using hasOwnProperty to test for an own property's existence:
The following code shows how to determine whether the `example` object contains a property named `prop`.
Example:
const example = {};
example.hasOwnProperty("prop"); // false
example.prop... | [
-1.0709726810455322,
-0.07354330271482468,
-0.5628635883331299,
0.40153899788856506,
-0.5565693378448486,
-1.4718000888824463,
0.575394332408905,
0.4049050211906433,
-0.022023171186447144,
0.6604348421096802,
-1.253373622894287,
0.49403390288352966,
-0.8598997592926025,
-0.4068413972854614... |
javascript/reference/global_objects/object/hasownproperty/index.md | JavaScript - Global Objects - Object - hasOwnProperty - 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";
// `hasOwnProperty` will only return true for... | [
-0.4232594668865204,
-0.03431239724159241,
-0.04759930819272995,
0.3553377091884613,
-0.46700185537338257,
-2.1721858978271484,
0.1973997801542282,
1.033486247062683,
0.415628582239151,
0.30404943227767944,
-0.5062644481658936,
0.4090460538864136,
-0.7873377799987793,
-0.5703818202018738,
... |
javascript/reference/global_objects/object/hasownproperty/index.md | JavaScript - Global Objects - Object - hasOwnProperty - Examples - Iterating over the properties of an object:
The following example shows how to iterate over the enumerable properties of an object without executing on inherited properties.
Example:
const buz = {
fog: "stack",
};
for (const name in buz) {
if (b... | [
-0.45204833149909973,
0.2897408902645111,
0.03890543803572655,
1.1482294797897339,
-0.1339823603630066,
-2.1275453567504883,
0.88780277967453,
-0.0054641361348330975,
-1.1336194276809692,
0.12763100862503052,
-0.475920170545578,
0.0722343698143959,
-0.5569908618927002,
-0.5627413988113403,... |
javascript/reference/global_objects/object/hasownproperty/index.md | JavaScript - Global Objects - Object - hasOwnProperty - Examples - Using hasOwnProperty as a property name:
JavaScript does not protect the property name `hasOwnProperty`; an object that has a property with this name may return incorrect results:
Example:
const foo = {
hasOwnProperty() {
return false;
},
b... | [
-0.23709045350551605,
0.19222070276737213,
-1.1008448600769043,
0.37463900446891785,
-0.39830803871154785,
-1.758497714996338,
0.5785409212112427,
-0.08671580255031586,
-0.7775228023529053,
0.31515926122665405,
-1.1645501852035522,
0.15224240720272064,
-0.731208324432373,
-0.99221003055572... |
javascript/reference/global_objects/object/hasownproperty/index.md | JavaScript - Global Objects - Object - hasOwnProperty - Examples - Objects created with Object.create(null):
`null`-prototype objects do not inherit from `Object.prototype`, making `hasOwnProperty()` inaccessible.
Example:
const foo = Object.create(null);
foo.prop = "exists";
foo.hasOwnProperty("prop"); // Uncaught ... | [
-0.6786577701568604,
0.43285876512527466,
-0.7038717269897461,
0.4132550060749054,
-0.2661616802215576,
-1.8341736793518066,
0.24981386959552765,
0.7973407506942749,
-0.427642285823822,
0.3730923533439636,
-1.1452183723449707,
0.19272607564926147,
-0.054485004395246506,
-0.6182250380516052... |
javascript/reference/global_objects/object/constructor/index.md | JavaScript - Global Objects - Object - constructor:
The `constructor` data property of an `Object` instance returns a reference to the constructor function that created the instance object. Note that the value of this property is a reference to the function itself, not a string containing the function's name.
Note: T... | [
-0.7869939804077148,
-0.94001704454422,
-1.2405507564544678,
1.1406382322311401,
0.10970975458621979,
-2.4873385429382324,
0.4001121520996094,
0.920269250869751,
-0.339438259601593,
-0.3401123285293579,
-0.8900510668754578,
0.1487734317779541,
-0.04522408917546272,
0.22413469851016998,
0... |
javascript/reference/global_objects/object/constructor/index.md | JavaScript - Global Objects - Object - constructor - Value:
A reference to the constructor function that created the instance object.
Note: This property is created by default on the `prototype` property of every constructor function and is inherited by all objects created by that constructor. | [
-0.14902639389038086,
-0.6743226647377014,
-0.6789869666099548,
0.5604677200317383,
-0.05914178863167763,
-2.470870018005371,
0.22147756814956665,
0.7040277719497681,
0.05923526734113693,
-0.5770094990730286,
-0.7384511828422546,
0.18565087020397186,
-0.09887004643678665,
0.608372688293457... |
javascript/reference/global_objects/object/constructor/index.md | JavaScript - Global Objects - Object - constructor - Description:
Any object (with the exception of `null` prototype objects) will have a `constructor` property on its `[[Prototype]]`. Objects created with literals will also have a `constructor` property that points to the constructor type for that object — for exampl... | [
-0.521264910697937,
-0.20264355838298798,
-0.021439095959067345,
0.553047776222229,
0.854763388633728,
-1.1468863487243652,
-0.1195010170340538,
1.4281727075576782,
-0.6192111372947693,
0.004568550270050764,
-1.1981631517410278,
-0.0960298702120781,
-0.3545854091644287,
-0.1603394448757171... |
javascript/reference/global_objects/object/constructor/index.md | JavaScript - Global Objects - Object - constructor - Examples - Displaying the constructor of an object:
The following example creates a constructor (`Tree`) and an object of that type (`theTree`). The example then displays the `constructor` property for the object `theTree`.
Example:
function Tree(name) {
this.na... | [
-0.6760240793228149,
0.1294996440410614,
-1.0804905891418457,
0.2320403754711151,
-0.29353106021881104,
-1.715442419052124,
0.08065871894359589,
0.5462868809700012,
-0.3875564932823181,
0.038193102926015854,
-0.57437664270401,
-0.1392495334148407,
-0.26974785327911377,
-0.1038728803396225,... |
javascript/reference/global_objects/object/constructor/index.md | JavaScript - Global Objects - Object - constructor - Examples - Assigning the constructor property to an object:
One can assign the `constructor` property of non-primitives.
Example:
const arr = [];
arr.constructor = String;
arr.constructor === String; // true
arr instanceof String; // false
arr instanceof Array; //... | [
-0.403802752494812,
-0.23008568584918976,
-1.1128621101379395,
0.989244282245636,
-0.31044965982437134,
-2.141726016998291,
0.1466980278491974,
0.5267941951751709,
0.154899463057518,
0.062159400433301926,
-1.1336078643798828,
-0.42510247230529785,
-0.7939924001693726,
-0.1888660192489624,
... |
javascript/reference/global_objects/object/constructor/index.md | JavaScript - Global Objects - Object - constructor - Examples - Changing the constructor of a constructor function's prototype:
Every constructor has a `prototype` property, which will become the instance's `[[Prototype]]` when called via the `new` operator. `ConstructorFunction.prototype.constructor` will therefore b... | [
0.5407155752182007,
0.31611567735671997,
-0.48489460349082947,
0.33221128582954407,
0.5474762320518494,
-0.6178240776062012,
0.9811134934425354,
1.5925800800323486,
-0.14565914869308472,
-0.32620400190353394,
-0.5065545439720154,
1.238423466682434,
-0.5523648858070374,
0.369188129901886,
... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty:
The `Object.defineProperty()` static method defines a new property directly on an object, or modifies an existing property on an object, and returns the object.
Example:
const object = {};
Object.defineProperty(object, "foo", {
value: 42,
writable: false,
}... | [
-0.592224657535553,
-0.4555591344833374,
-1.0479552745819092,
0.11566228419542313,
-0.17179782688617706,
-1.8045166730880737,
0.19549839198589325,
0.42718786001205444,
0.42293933033943176,
-0.058632127940654755,
-1.1985963582992554,
0.08424682170152664,
0.4914645552635193,
-0.1851872503757... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Syntax:
Example:
Object.defineProperty(obj, prop, descriptor) | [
-0.9183502197265625,
-0.09768414497375488,
-0.6742082834243774,
-0.7321982383728027,
-0.9152072668075562,
-1.4921597242355347,
-0.41606900095939636,
0.24672186374664307,
0.7228626012802124,
-0.6328514814376831,
-0.8120736479759216,
0.06685288995504379,
0.09741881489753723,
-0.1904635727405... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Syntax - Parameters:
- `obj`: The object on which to define the property.
- `prop`: A string or `Symbol` specifying the key of the property to be defined or modified.
- `descriptor`: The descriptor for the property being defined or modified. | [
-0.7296344041824341,
-0.25008559226989746,
-0.9933200478553772,
-0.1632823497056961,
-0.19883325695991516,
-1.7462116479873657,
0.09005727618932724,
-0.0030959011055529118,
0.9705281257629395,
-0.2767649292945862,
-0.9839821457862854,
0.606353759765625,
-0.44919148087501526,
0.235632672905... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Syntax - Return value:
The object that was passed to the function, with the specified property added or modified. | [
-0.14063578844070435,
-0.09812105447053909,
-0.725489616394043,
0.1290455162525177,
-0.6467412114143372,
-1.6782164573669434,
0.3624032735824585,
1.1415513753890991,
0.13494543731212616,
-0.3112691044807434,
-0.9029168486595154,
0.6935164332389832,
-0.38120797276496887,
1.026007056236267,
... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Description:
`Object.defineProperty()` allows a precise addition to or modification of a property on an object. Normal property addition through assignment creates properties which show up during property enumeration (`for...in`, `Object.keys()`, etc.), whose val... | [
-0.22725318372249603,
0.37789201736450195,
-0.6422485113143921,
0.856857419013977,
0.2602132558822632,
-0.8323947787284851,
0.5498276352882385,
0.8851011991500854,
0.19440877437591553,
-0.3767968714237213,
-0.866443395614624,
0.38001853227615356,
-0.43595606088638306,
-0.14534978568553925,... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Examples - Creating a property:
When the property specified doesn't exist in the object, `Object.defineProperty()` creates a new property as described. Fields may be omitted from the descriptor and default values for those fields are inputted.
Example:
const o ... | [
-0.23161225020885468,
-0.006941280327737331,
-0.2955884635448456,
0.7783434391021729,
0.07906544208526611,
-1.0254387855529785,
1.0922092199325562,
0.9506402015686035,
-0.09509483724832535,
-0.11938173323869705,
-1.1720837354660034,
-0.17317937314510345,
-0.2787171006202698,
-0.30289077758... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Examples - Modifying a property:
When modifying an existing property, the current property configuration determines if the operator succeeds, does nothing, or throws a `TypeError`. | [
-0.393228679895401,
0.02902865968644619,
-0.6275529265403748,
0.244925394654274,
-0.21564239263534546,
-1.2989516258239746,
-0.11058532446622849,
1.0003358125686646,
0.7305062413215637,
-0.5674595236778259,
-1.2157055139541626,
-0.7817569971084595,
-0.14252623915672302,
-0.5977045297622681... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Examples - Modifying a property - Writable attribute:
When the `writable` property attribute is `false`, the property is said to be "non-writable". It cannot be reassigned. Trying to write to a non-writable property doesn't change it and results in an error in st... | [
-0.7387353181838989,
0.31209254264831543,
-0.1184435486793518,
-0.06779133528470993,
-0.03947095945477486,
-1.5394231081008911,
0.33481067419052124,
0.7251265645027161,
0.7409415245056152,
-0.42516249418258667,
-0.23270481824874878,
-0.34315115213394165,
-0.23639242351055145,
-0.1941297948... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Examples - Modifying a property - Enumerable attribute:
The `enumerable` property attribute defines whether the property is considered by `Object.assign()` or the spread operator. For non-`Symbol` properties, it also defines whether it shows up in a `for...in` lo... | [
-0.17922860383987427,
0.32852551341056824,
-0.1313054859638214,
0.543099582195282,
0.257632851600647,
-1.156643271446228,
0.20540305972099304,
0.8050343990325928,
-0.09685444086790085,
0.2579801678657532,
-1.2289336919784546,
0.33032652735710144,
-0.643981397151947,
-0.05597710609436035,
... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Examples - Modifying a property - Configurable attribute:
The `configurable` attribute controls whether the property can be deleted from the object and whether its attributes (other than `value` and `writable`) can be changed.
This example illustrates a non-conf... | [
0.8060005307197571,
0.2946055829524994,
-0.3947509527206421,
0.572012186050415,
0.7674163579940796,
-1.1872375011444092,
0.6647992730140686,
1.3729355335235596,
-0.33589380979537964,
-0.12505659461021423,
-0.4323118031024933,
0.7029104232788086,
-0.6904323101043701,
-0.009600574150681496,
... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Examples - Adding properties and default values:
It is important to consider the way default values of attributes are applied. There is often a difference between using property accessors to assign a value and using `Object.defineProperty()`, as shown in the exam... | [
-0.465132474899292,
-0.2446291446685791,
-1.3268609046936035,
0.6392709612846375,
-0.5190635919570923,
-2.0932929515838623,
0.7919694185256958,
0.04209150746464729,
0.4773043990135193,
-0.07132060825824738,
-1.1718629598617554,
-0.16164587438106537,
0.18169893324375153,
-0.3867891430854797... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Examples - Custom setters and getters:
The example below shows how to implement a self-archiving object. When `temperature` property is set, the `archive` array gets a log entry.
Example:
function Archiver() {
let temperature = null;
const archive = [];
... | [
-0.5786950588226318,
-0.5248709917068481,
-1.8330398797988892,
0.8205470442771912,
0.0774063766002655,
-1.7750134468078613,
-0.1650593876838684,
-0.06496267020702362,
0.06640325486660004,
0.02604059688746929,
0.14201615750789642,
0.0840514749288559,
-0.6841582655906677,
0.28122949600219727... |
javascript/reference/global_objects/object/defineproperty/index.md | JavaScript - Global Objects - Object - defineProperty - Examples - Inheritance of properties:
If an accessor property is inherited, its `get` and `set` methods will be called when the property is accessed and modified on descendant objects. If these methods use a variable to store the value, this value will be shared ... | [
-0.9062222838401794,
-0.40237870812416077,
-1.4289315938949585,
0.508837103843689,
-0.21519151329994202,
-1.9808763265609741,
0.04951602593064308,
1.2655560970306396,
0.5005751848220825,
-0.6194668412208557,
-0.6092063188552856,
0.26915520429611206,
-0.9531563520431519,
0.29925745725631714... |
javascript/reference/global_objects/object/create/index.md | JavaScript - Global Objects - Object - create:
The `Object.create()` static method creates a new object, using an existing object as the prototype of the newly created object.
Example:
const person = {
isHuman: false,
printIntroduction() {
console.log(`My name is ${this.name}. Am I human? ${this.isHuman}`);
... | [
-0.5496399402618408,
-0.6461609601974487,
-1.0750623941421509,
0.5801750421524048,
0.13918468356132507,
-1.899010181427002,
-0.2577489912509918,
0.8043297529220581,
0.34104642271995544,
0.27856144309043884,
-1.1876555681228638,
-0.08891689032316208,
-0.2295096516609192,
-0.3260020613670349... |
javascript/reference/global_objects/object/create/index.md | JavaScript - Global Objects - Object - create - Syntax:
Example:
Object.create(proto)
Object.create(proto, propertiesObject) | [
0.1540602296590805,
0.22058765590190887,
-0.3525841236114502,
-0.21999923884868622,
-0.6139605045318604,
-1.9136329889297485,
-0.47494301199913025,
0.6406984925270081,
-0.009208193980157375,
-0.8954682946205139,
-0.6512094140052795,
0.1721690595149994,
-0.19839872419834137,
-0.329135775566... |
javascript/reference/global_objects/object/create/index.md | JavaScript - Global Objects - Object - create - Syntax - Parameters:
- `proto`: The object which should be the prototype of the newly-created object.
- `propertiesObject` (optional): If specified and not `undefined`, an object whose enumerable own properties specify property descriptors to be added to the newly-create... | [
-0.29368823766708374,
-0.15028594434261322,
-0.40505287051200867,
0.2328338474035263,
-0.23034882545471191,
-1.4521541595458984,
0.07927580177783966,
0.3277180790901184,
0.44814392924308777,
-0.276571124792099,
-1.194873332977295,
0.24420785903930664,
-0.610725998878479,
0.0707140415906906... |
javascript/reference/global_objects/object/create/index.md | JavaScript - Global Objects - Object - create - Syntax - Return value:
A new object with the specified prototype object and properties. | [
0.2792574167251587,
-0.2935042083263397,
-0.42441055178642273,
0.303147554397583,
-0.7184095978736877,
-1.2393295764923096,
-0.1336810141801834,
1.0143007040023804,
-0.15802255272865295,
-0.007510559167712927,
-0.9011567234992981,
0.7791281938552856,
-0.4456953704357147,
0.759756326675415,... |
javascript/reference/global_objects/object/create/index.md | JavaScript - Global Objects - Object - create - Syntax - Exceptions:
- `TypeError`: Thrown if `proto` is neither `null` nor an `Object`. | [
-0.4262430667877197,
-0.26219138503074646,
-0.03250498324632645,
0.20285576581954956,
-0.4211653470993042,
-1.3735493421554565,
-0.18292170763015747,
0.784524142742157,
-0.5977926254272461,
-0.16460026800632477,
-0.726088285446167,
-0.5056277513504028,
-0.26543623208999634,
-0.593700349330... |
javascript/reference/global_objects/object/create/index.md | JavaScript - Global Objects - Object - create - Examples - Classical inheritance with Object.create():
Below is an example of how to use `Object.create()` to achieve classical inheritance. This is for a single inheritance, which is all that JavaScript supports.
Example:
// Shape - superclass
function Shape() {
thi... | [
-1.2073462009429932,
0.32961195707321167,
-0.8925636410713196,
0.7013038396835327,
0.4632713496685028,
-1.840396523475647,
0.43325895071029663,
0.6075006723403931,
0.11226744949817657,
-0.4891098737716675,
-0.24917460978031158,
0.3204406797885895,
-0.6777477264404297,
0.18628281354904175,
... |
javascript/reference/global_objects/object/create/index.md | JavaScript - Global Objects - Object - create - Examples - Using propertiesObject argument with Object.create():
`Object.create()` allows fine-tuned control over the object creation process. The object initializer syntax is, in fact, a syntax sugar of `Object.create()`. With `Object.create()`, we can create objects wi... | [
0.7333288788795471,
0.5528088212013245,
-0.4997517764568329,
1.2003929615020752,
0.8698788285255432,
-1.0149251222610474,
0.10737839341163635,
0.7975224256515503,
0.12355618178844452,
-0.2243746668100357,
-1.3652927875518799,
0.02872685343027115,
-0.572047770023346,
-0.32192060351371765,
... |
javascript/reference/global_objects/object/fromentries/index.md | JavaScript - Global Objects - Object - fromEntries:
The `Object.fromEntries()` static method transforms a list of key-value pairs into an object.
Example:
const entries = new Map([
["foo", "bar"],
["baz", 42],
]);
const obj = Object.fromEntries(entries);
console.log(obj);
// Expected output: Object { foo: "bar... | [
0.7827860116958618,
-0.7906137704849243,
-1.2124695777893066,
0.2983563542366028,
-0.15372905135154724,
-2.0847198963165283,
0.5020542740821838,
-0.26347994804382324,
-0.11786487698554993,
0.39961376786231995,
-0.9645421504974365,
-0.12434787303209305,
0.1287296712398529,
-0.29162430763244... |
javascript/reference/global_objects/object/fromentries/index.md | JavaScript - Global Objects - Object - fromEntries - Syntax:
Example:
Object.fromEntries(iterable) | [
0.9835315346717834,
-0.23835794627666473,
-0.2998090088367462,
-0.003388444660231471,
-0.45522111654281616,
-2.279100179672241,
0.41677674651145935,
0.5747575163841248,
-0.6097211241722107,
-0.3202904462814331,
-0.5735566020011902,
-0.10884007811546326,
-0.33139678835868835,
0.091255322098... |
javascript/reference/global_objects/object/fromentries/index.md | JavaScript - Global Objects - Object - fromEntries - Syntax - Parameters:
- `iterable`: An iterable, such as an `Array` or `Map`, containing a list of objects. Each object should have two properties: - `0`: A string or symbol representing the property key. - `1`: The property value. Typically, this object is implem... | [
0.15813308954238892,
0.05806533247232437,
-0.566947340965271,
0.8035964965820312,
0.17695191502571106,
-1.6280438899993896,
0.03248123452067375,
0.9205952882766724,
-0.35394808650016785,
-0.15287724137306213,
-0.7090721130371094,
0.634600818157196,
-0.6509261727333069,
-0.01428568176925182... |
javascript/reference/global_objects/object/fromentries/index.md | JavaScript - Global Objects - Object - fromEntries - Syntax - Return value:
A new object whose properties are given by the entries of the iterable. | [
0.3254551589488983,
-0.4032427668571472,
-0.5848268866539001,
0.20551685988903046,
-0.5757387280464172,
-1.831565499305725,
0.2037530541419983,
0.8691532611846924,
-0.3784545361995697,
-0.19127370417118073,
-0.9576876163482666,
0.36230260133743286,
-0.40097910165786743,
1.1680082082748413,... |
javascript/reference/global_objects/object/fromentries/index.md | JavaScript - Global Objects - Object - fromEntries - Description:
The `Object.fromEntries()` method takes a list of key-value pairs and returns a new object whose properties are given by those entries. The `iterable` argument is expected to be an object that implements a `[Symbol.iterator]()` method. The method return... | [
0.18579037487506866,
-0.3397068679332733,
-0.7183053493499756,
0.8756468296051025,
0.1484585702419281,
-1.7069573402404785,
0.03870239853858948,
0.631476104259491,
-0.9469389319419861,
0.47427406907081604,
-0.7275481820106506,
0.8249511122703552,
-0.1974397748708725,
0.18719035387039185,
... |
javascript/reference/global_objects/object/fromentries/index.md | JavaScript - Global Objects - Object - fromEntries - Examples - Converting a Map to an Object:
With `Object.fromEntries`, you can convert from `Map` to `Object`:
Example:
const map = new Map([
["foo", "bar"],
["baz", 42],
]);
const obj = Object.fromEntries(map);
console.log(obj); // { foo: "bar", baz: 42 } | [
0.8697907328605652,
-0.3191567063331604,
-0.846561849117279,
0.16603083908557892,
-0.3886599540710449,
-2.821011781692505,
0.21041947603225708,
-0.6357784271240234,
0.34362930059432983,
0.1686873435974121,
-0.3114175796508789,
-0.3241499960422516,
0.3973461091518402,
-0.3598332107067108,
... |
javascript/reference/global_objects/object/fromentries/index.md | JavaScript - Global Objects - Object - fromEntries - Examples - Converting an Array to an Object:
With `Object.fromEntries`, you can convert from `Array` to `Object`:
Example:
const arr = [
["0", "a"],
["1", "b"],
["2", "c"],
];
const obj = Object.fromEntries(arr);
console.log(obj); // { 0: "a", 1: "b", 2: "c"... | [
0.4274235665798187,
-0.0898260846734047,
-0.5733632445335388,
0.38406112790107727,
-0.33559751510620117,
-2.072533130645752,
-0.22285868227481842,
0.23007991909980774,
0.2488533854484558,
0.24258476495742798,
-0.08500558882951736,
-0.5525170564651489,
0.06551337242126465,
-0.58385133743286... |
javascript/reference/global_objects/object/fromentries/index.md | JavaScript - Global Objects - Object - fromEntries - Examples - Object transformations:
With `Object.fromEntries`, its reverse method `Object.entries()`, and array manipulation methods, you are able to transform objects like this:
Example:
const object1 = { a: 1, b: 2, c: 3 };
const object2 = Object.fromEntries(
... | [
0.63463294506073,
-0.07708918303251266,
-0.37022244930267334,
0.5178567171096802,
-0.3532232940196991,
-1.5565285682678223,
0.564755916595459,
0.3459862470626831,
-0.34780240058898926,
0.05701552331447601,
-0.6047381162643433,
-0.4206089675426483,
0.00886476319283247,
-0.5971582531929016,
... |
javascript/reference/global_objects/object/tostring/index.md | JavaScript - Global Objects - Object - toString:
The `toString()` method of `Object` instances returns a string representing this object. This method is meant to be overridden by derived objects for custom type coercion logic.
Example:
const map = new Map();
console.log(map.toString());
// Expected output: "[object... | [
-0.705512285232544,
-0.480562686920166,
-0.5017703771591187,
0.17469732463359833,
-0.00567599618807435,
-2.880324363708496,
0.07954081147909164,
-0.37030333280563354,
-0.23580241203308105,
-0.10587575286626816,
-0.7060233354568481,
-0.013152488507330418,
0.037315960973501205,
0.05987034365... |
javascript/reference/global_objects/object/tostring/index.md | JavaScript - Global Objects - Object - toString - Syntax:
Example:
toString() | [
-1.0012017488479614,
0.4039522409439087,
-0.5131070017814636,
-0.3400016129016876,
-0.49881333112716675,
-2.5339176654815674,
0.08687776327133179,
0.30589786171913147,
-0.27247071266174316,
-1.0919692516326904,
-0.26023632287979126,
0.2561180889606476,
-0.19111403822898865,
-0.339936971664... |
javascript/reference/global_objects/object/tostring/index.md | JavaScript - Global Objects - Object - toString - Syntax - Parameters:
By default `toString()` takes no parameters. However, objects that inherit from `Object` may override it with their own implementations that do take parameters. For example, the `Number.prototype.toString()` and `BigInt.prototype.toString()` method... | [
-1.241979718208313,
0.2494162917137146,
-0.9945567846298218,
0.022697392851114273,
-0.32411903142929077,
-2.170424461364746,
0.5671926140785217,
-0.11798626184463501,
-0.3282354474067688,
-1.3258150815963745,
-1.1624822616577148,
0.2779391407966614,
-0.41421785950660706,
0.0017848460702225... |
javascript/reference/global_objects/object/tostring/index.md | JavaScript - Global Objects - Object - toString - Syntax - Return value:
A string representing the object. | [
-0.5809269547462463,
-0.05812769755721092,
-0.5074686408042908,
-0.3478557765483856,
-0.5999996066093445,
-2.4533135890960693,
0.1468578726053238,
0.6872751712799072,
-0.28557655215263367,
-0.3948327600955963,
-0.5288488268852234,
0.7536508440971375,
-0.3656857907772064,
0.7688660621643066... |
javascript/reference/global_objects/object/tostring/index.md | JavaScript - Global Objects - Object - toString - Description:
JavaScript calls the `toString` method to convert an object to a primitive value. You rarely need to invoke the `toString` method yourself; JavaScript automatically invokes it when encountering an object where a primitive value is expected.
This method is... | [
0.049104638397693634,
-0.3581436574459076,
-0.6879902482032776,
0.4582483172416687,
1.063456416130066,
-1.1761268377304077,
0.4728434979915619,
0.9458781480789185,
-0.5944315791130066,
-0.07644641399383545,
-0.21261011064052582,
0.6244001388549805,
-0.16531988978385925,
0.6869960427284241,... |
javascript/reference/global_objects/object/tostring/index.md | JavaScript - Global Objects - Object - toString - Examples - Overriding toString for custom objects:
You can create a function to be called in place of the default `toString()` method. The `toString()` function you create should return a string value. If it returns an object and the method is called implicitly during ... | [
-0.21229484677314758,
-0.5089272856712341,
-0.5264492630958557,
0.9917711019515991,
0.862034797668457,
-0.9231820106506348,
-0.6561459302902222,
0.5553416609764099,
-0.9482130408287048,
-0.3111397624015808,
-0.03667513281106949,
0.3962491750717163,
0.20355123281478882,
0.24223603308200836,... |
javascript/reference/global_objects/object/tostring/index.md | JavaScript - Global Objects - Object - toString - Examples - Using toString() to detect object class:
`toString()` can be used with every object and (by default) allows you to get its class.
Example:
const toString = Object.prototype.toString;
toString.call(new Date()); // [object Date]
toString.call(new String());... | [
-0.4552591145038605,
0.1222912147641182,
-0.2641967535018921,
0.4977477192878723,
0.6756910681724548,
-1.7431949377059937,
0.17800308763980865,
0.706640899181366,
-0.5456722974777222,
0.35493531823158264,
-0.9901485443115234,
-0.2585255801677704,
0.006889116019010544,
-0.2637638449668884,
... |
javascript/reference/global_objects/object/keys/index.md | JavaScript - Global Objects - Object - keys:
The `Object.keys()` static method returns an array of a given object's own enumerable string-keyed property names.
Example:
const object = {
a: "some string",
b: 42,
c: false,
};
console.log(Object.keys(object));
// Expected output: Array ["a", "b", "c"] | [
-0.5176842212677002,
-0.4054391384124756,
-1.4661301374435425,
-0.08954572677612305,
-0.07063141465187073,
-1.7792917490005493,
0.3968695104122162,
0.24239258468151093,
-0.5241643190383911,
0.034309569746255875,
-0.40421515703201294,
0.5515903830528259,
0.24428491294384003,
0.0356329642236... |
javascript/reference/global_objects/object/keys/index.md | JavaScript - Global Objects - Object - keys - Syntax:
Example:
Object.keys(obj) | [
0.16316072642803192,
0.1599789410829544,
-1.5642259120941162,
-0.5640464425086975,
-0.8255216479301453,
-2.0028011798858643,
0.5353715419769287,
0.6760880351066589,
-0.4341476857662201,
-0.7779053449630737,
-0.387711763381958,
0.35794875025749207,
-0.21838538348674774,
0.2633553147315979,
... |
javascript/reference/global_objects/object/keys/index.md | JavaScript - Global Objects - Object - keys - Syntax - Parameters:
- `obj`: An object. | [
0.23896072804927826,
0.10540273785591125,
-1.6505686044692993,
-0.7339417338371277,
-0.446076899766922,
-1.6186981201171875,
0.18089571595191956,
0.48184216022491455,
0.2511487603187561,
-0.7673518061637878,
-1.33265221118927,
0.292532354593277,
-0.14561302959918976,
0.5263303518295288,
... |
javascript/reference/global_objects/object/keys/index.md | JavaScript - Global Objects - Object - keys - Syntax - Return value:
An array of strings representing the given object's own enumerable string-keyed property keys. | [
-0.11125512421131134,
-0.06994111090898514,
-0.8903411030769348,
0.08516832441091537,
-0.645867109298706,
-1.7694145441055298,
0.8213449120521545,
0.917659342288971,
-0.47978493571281433,
-0.10005784779787064,
-0.6573328375816345,
1.030436635017395,
-0.7400045990943909,
1.0796213150024414,... |
javascript/reference/global_objects/object/keys/index.md | JavaScript - Global Objects - Object - keys - Description:
`Object.keys()` returns an array whose elements are strings corresponding to the enumerable string-keyed property names found directly upon `object`. This is the same as iterating with a `for...in` loop, except that a `for...in` loop enumerates properties in t... | [
-0.48165085911750793,
-0.32542884349823,
-1.2192431688308716,
0.4245876371860504,
0.05835258588194847,
-1.9591894149780273,
0.35174521803855896,
-0.04437487572431564,
-0.8046442270278931,
0.3447211980819702,
-0.19102448225021362,
0.6793742179870605,
0.009874856099486351,
0.0336708985269069... |
javascript/reference/global_objects/object/keys/index.md | JavaScript - Global Objects - Object - keys - Examples - Using Object.keys():
Example:
// Basic array
const arr = ["a", "b", "c"];
console.log(Object.keys(arr)); // ['0', '1', '2']
// Array-like object
const obj = { 0: "a", 1: "b", 2: "c" };
console.log(Object.keys(obj)); // ['0', '1', '2']
// Array-like object wit... | [
0.20828001201152802,
0.4566769003868103,
-1.248937964439392,
-0.20694538950920105,
-0.09847519546747208,
-1.5265464782714844,
0.375813364982605,
-0.2953544557094574,
-0.2319817692041397,
0.11476029455661774,
-0.012082540430128574,
0.12247329205274582,
-0.39892613887786865,
-0.1731570810079... |
javascript/reference/global_objects/object/keys/index.md | JavaScript - Global Objects - Object - keys - Examples - Using Object.keys() on primitives:
Non-object arguments are coerced to objects. `undefined` and `null` cannot be coerced to objects and throw a `TypeError` upfront. Only strings may have own enumerable properties, while all other primitives return an empty array... | [
-0.16503208875656128,
0.11303441226482391,
-0.7865180969238281,
0.5230448246002197,
-0.12596148252487183,
-2.4781551361083984,
1.5630348920822144,
0.20455053448677063,
-0.3865920901298523,
0.28489819169044495,
-0.15047475695610046,
-0.6660862565040588,
0.028443435207009315,
-0.476455926895... |
javascript/reference/global_objects/object/getprototypeof/index.md | JavaScript - Global Objects - Object - getPrototypeOf:
The `Object.getPrototypeOf()` static method returns the prototype (i.e., the value of the internal `[[Prototype]]` property) of the specified object.
Example:
const prototype = {};
const object = Object.create(prototype);
console.log(Object.getPrototypeOf(objec... | [
-0.7172088027000427,
-0.4477402865886688,
-0.7873553037643433,
-0.18783850967884064,
-0.1814938187599182,
-1.3311175107955933,
-0.3664502203464508,
0.2241818755865097,
0.26531392335891724,
0.08902768790721893,
-0.6855124235153198,
0.34569650888442993,
0.1155201643705368,
-0.107428498566150... |
javascript/reference/global_objects/object/getprototypeof/index.md | JavaScript - Global Objects - Object - getPrototypeOf - Syntax:
Example:
Object.getPrototypeOf(obj) | [
-0.3723837733268738,
-0.001560652512125671,
-0.6363393068313599,
-0.8363105058670044,
-0.655271053314209,
-1.6061840057373047,
-0.20977555215358734,
0.5088851451873779,
0.055927421897649765,
-0.7113656401634216,
-0.7015365362167358,
0.07940046489238739,
-0.04926321282982826,
-0.02151522226... |
javascript/reference/global_objects/object/getprototypeof/index.md | JavaScript - Global Objects - Object - getPrototypeOf - Syntax - Parameters:
- `obj`: The object whose prototype is to be returned. | [
-0.5291371941566467,
0.2484556883573532,
-0.7677275538444519,
-0.5000739097595215,
-0.5020899176597595,
-1.0956217050552368,
0.21184469759464264,
0.4228781461715698,
-0.001642947900108993,
-0.14568814635276794,
-1.1376653909683228,
0.6581615209579468,
-0.01704007387161255,
0.96117162704467... |
javascript/reference/global_objects/object/getprototypeof/index.md | JavaScript - Global Objects - Object - getPrototypeOf - Syntax - Return value:
The prototype of the given object, which may be `null`. | [
-0.7026716470718384,
0.16758587956428528,
-0.1990594118833542,
-0.3857590854167938,
-0.32156604528427124,
-1.3362524509429932,
0.36123719811439514,
1.205291748046875,
0.3082170784473419,
0.00315787922590971,
-0.907606303691864,
0.5674337148666382,
-0.22027255594730377,
0.36367982625961304,... |
javascript/reference/global_objects/object/getprototypeof/index.md | JavaScript - Global Objects - Object - getPrototypeOf - Examples - Using getPrototypeOf:
Example:
const proto = {};
const obj = Object.create(proto);
Object.getPrototypeOf(obj) === proto; // true | [
-0.17978383600711823,
-0.13379964232444763,
-0.2641741931438446,
-0.10346988588571548,
-0.37671759724617004,
-1.4277880191802979,
-0.7338113784790039,
0.4184728264808655,
-0.040611494332551956,
-0.3124436140060425,
-0.7068064212799072,
-0.09180314093828201,
0.05575816333293915,
-0.12913876... |
javascript/reference/global_objects/object/getprototypeof/index.md | JavaScript - Global Objects - Object - getPrototypeOf - Examples - Non-object coercion:
In ES5, it will throw a `TypeError` exception if the `obj` parameter isn't an object. In ES2015, the parameter will be coerced to an `Object`.
Example:
Object.getPrototypeOf("foo");
// TypeError: "foo" is not an object (ES5 code)... | [
-0.4365888237953186,
-0.42600521445274353,
-0.2607916295528412,
-0.004891830962151289,
-0.22335438430309296,
-1.6977719068527222,
-0.4669729471206665,
0.7020302414894104,
-0.14552700519561768,
0.007558395620435476,
-0.5472419857978821,
-0.7434903979301453,
0.06884527206420898,
-0.417622089... |
javascript/reference/global_objects/object/issealed/index.md | JavaScript - Global Objects - Object - isSealed:
The `Object.isSealed()` static method determines if an object is sealed.
Example:
const object = {
foo: 42,
};
console.log(Object.isSealed(object));
// Expected output: false
Object.seal(object);
console.log(Object.isSealed(object));
// Expected output: true | [
-1.2313005924224854,
-0.4921707808971405,
-0.9055730700492859,
-0.3032650947570801,
-0.15945355594158173,
-2.2264065742492676,
-0.21699796617031097,
0.49738243222236633,
-0.4229487478733063,
0.29312771558761597,
-0.6763280630111694,
-0.3268842101097107,
0.2836834490299225,
-0.0721813216805... |
javascript/reference/global_objects/object/issealed/index.md | JavaScript - Global Objects - Object - isSealed - Syntax:
Example:
Object.isSealed(obj) | [
-0.7378092408180237,
0.46078112721443176,
-0.8282632827758789,
-0.650185763835907,
-0.6326731443405151,
-2.135319471359253,
0.2966195344924927,
0.6623464822769165,
-0.3715682327747345,
-0.37688371539115906,
-0.7491511106491089,
-0.04452792927622795,
-0.010683069005608559,
-0.03652784228324... |
javascript/reference/global_objects/object/issealed/index.md | JavaScript - Global Objects - Object - isSealed - Syntax - Parameters:
- `obj`: The object which should be checked. | [
-0.4538942873477936,
0.39399150013923645,
-1.35209321975708,
-0.7412931323051453,
-0.2115798443555832,
-1.5543098449707031,
0.38934311270713806,
-0.14732712507247925,
-0.0655255988240242,
0.2474190592765808,
-1.2728325128555298,
-0.14198210835456848,
-0.2411743700504303,
0.6310813426971436... |
javascript/reference/global_objects/object/issealed/index.md | JavaScript - Global Objects - Object - isSealed - Syntax - Return value:
A `Boolean` indicating whether or not the given object is sealed. | [
-1.2391477823257446,
0.044688157737255096,
-0.6592817902565002,
-0.46773698925971985,
-0.6624136567115784,
-1.814215898513794,
0.19590476155281067,
1.0952270030975342,
-0.7393932342529297,
-0.01654904894530773,
-0.7700034976005554,
0.843370258808136,
0.1061864122748375,
0.7659151554107666,... |
javascript/reference/global_objects/object/issealed/index.md | JavaScript - Global Objects - Object - isSealed - Description:
Returns `true` if the object is sealed, otherwise `false`. An object is sealed if it is not `extensible` and if all its properties are non-configurable and therefore not removable (but not necessarily non-writable). | [
-1.408868432044983,
0.1365010291337967,
-0.5659511089324951,
-0.034702613949775696,
-0.7067673802375793,
-2.373081922531128,
-0.08420798182487488,
0.9698132872581482,
-0.3579893112182617,
0.11396688967943192,
-0.4329806864261627,
0.18151764571666718,
-0.19279910624027252,
0.098156139254570... |
javascript/reference/global_objects/object/issealed/index.md | JavaScript - Global Objects - Object - isSealed - Examples - Using Object.isSealed:
Example:
// Objects aren't sealed by default.
const empty = {};
Object.isSealed(empty); // false
// If you make an empty object non-extensible,
// it is vacuously sealed.
Object.preventExtensions(empty);
Object.isSealed(empty); // tr... | [
-1.0258371829986572,
0.5471073985099792,
-0.7858930826187134,
-0.20342004299163818,
0.01702638901770115,
-2.5314435958862305,
0.27892011404037476,
0.33276742696762085,
0.09987238794565201,
0.5197522044181824,
-0.7310881018638611,
-0.34072157740592957,
-0.13420546054840088,
-0.1907740682363... |
javascript/reference/global_objects/object/issealed/index.md | JavaScript - Global Objects - Object - isSealed - 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 `true` without any errors if a non-object argument is passed, since primitives are, by definition, immutab... | [
-0.5394657850265503,
-0.24253621697425842,
-0.3446606397628784,
-0.07136854529380798,
-0.08047293871641159,
-2.755335807800293,
0.7746036052703857,
0.887860894203186,
-0.26677459478378296,
0.2955056428909302,
-0.13747069239616394,
-0.8811742067337036,
-0.03885935992002487,
-0.3390065133571... |
javascript/reference/global_objects/object/tolocalestring/index.md | JavaScript - Global Objects - Object - toLocaleString:
The `toLocaleString()` method of `Object` instances returns a string representing this object. This method is meant to be overridden by derived objects for locale-specific purposes.
Example:
const date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
console.log(da... | [
-0.7302225232124329,
-0.08378951996564865,
-0.9260462522506714,
-0.09279783815145493,
0.1781097799539566,
-2.334333896636963,
-0.13159197568893433,
-0.3143301010131836,
-0.446822851896286,
-0.07961190491914749,
-0.8085764646530151,
1.0798510313034058,
-0.2121485471725464,
0.579369962215423... |
javascript/reference/global_objects/object/tolocalestring/index.md | JavaScript - Global Objects - Object - toLocaleString - Syntax:
Example:
toLocaleString() | [
-0.5639297962188721,
0.5864297747612,
-0.16196341812610626,
-0.27744215726852417,
-0.3890411853790283,
-2.497663736343384,
0.3267132341861725,
0.2195988893508911,
-0.29475679993629456,
-1.290164589881897,
-0.10284735262393951,
0.3982205390930176,
-0.3837053179740906,
-0.20045515894889832,
... |
javascript/reference/global_objects/object/tolocalestring/index.md | JavaScript - Global Objects - Object - toLocaleString - Syntax - Parameters:
None. However, all objects that override this method are expected to accept at most two parameters, corresponding to `locales` and `options`, such as `Number.prototype.toLocaleString`. The parameter positions should not be used for any other ... | [
-0.4562077820301056,
-0.15919578075408936,
-0.7704631686210632,
0.4739421606063843,
-0.33713486790657043,
-2.0821619033813477,
0.270759642124176,
-0.5760387778282166,
-0.08352991938591003,
-1.1225965023040771,
-0.9839258193969727,
0.4856569766998291,
0.5710634589195251,
-0.2457092851400375... |
javascript/reference/global_objects/object/tolocalestring/index.md | JavaScript - Global Objects - Object - toLocaleString - Syntax - Return value:
The return value of calling `this.toString()`. | [
-0.8048365712165833,
0.5139065980911255,
-0.2642727494239807,
-0.04664989560842514,
-0.25629371404647827,
-2.0720887184143066,
0.635035514831543,
0.27487707138061523,
-0.20781724154949188,
-0.5890934467315674,
-0.6787070631980896,
0.9252833724021912,
-0.1023503839969635,
0.5926199555397034... |
javascript/reference/global_objects/object/tolocalestring/index.md | JavaScript - Global Objects - Object - toLocaleString - Description:
All objects that inherit from `Object.prototype` (that is, all except `null`-prototype objects) inherit the `toLocaleString()` method. `Object`'s `toLocaleString` returns the result of calling `this.toString()`.
This function is provided to give obj... | [
-1.2122633457183838,
0.2550102174282074,
-0.7098787426948547,
-0.05838176980614662,
0.24092413485050201,
-2.646446704864502,
0.07161101698875427,
0.08801998198032379,
-0.4035426676273346,
-1.038032054901123,
-0.8614081740379333,
0.520830512046814,
-0.4829842746257782,
0.29197412729263306,
... |
javascript/reference/global_objects/object/tolocalestring/index.md | JavaScript - Global Objects - Object - toLocaleString - Examples - Using the base toLocaleString() method:
The base `toLocaleString()` method simply calls `toString()`.
Example:
const obj = {
toString() {
return "My Object";
},
};
console.log(obj.toLocaleString()); // "My Object" | [
-0.2185041606426239,
0.5966318249702454,
-0.9732650518417358,
0.1786545217037201,
0.08061690628528595,
-2.432736396789551,
-0.09683098644018173,
-0.5224359631538391,
0.021843507885932922,
-0.7956077456474304,
-0.6467703580856323,
0.6387927532196045,
-0.3432679772377014,
-0.3335116803646087... |
javascript/reference/global_objects/object/tolocalestring/index.md | JavaScript - Global Objects - Object - toLocaleString - Examples - Array toLocaleString() override:
`Array.prototype.toLocaleString()` is used to print array values as a string by invoking each element's `toLocaleString()` method and joining the results with a locale-specific separator. For example:
Example:
const t... | [
0.054289184510707855,
0.28353747725486755,
-0.40047457814216614,
0.8461717963218689,
0.27851107716560364,
-1.4381859302520752,
0.01075180247426033,
-0.2713533937931061,
0.3761860132217407,
-0.07246139645576477,
-0.32915323972702026,
1.0346615314483643,
-0.23192906379699707,
-0.421975135803... |
javascript/reference/global_objects/object/tolocalestring/index.md | JavaScript - Global Objects - Object - toLocaleString - Examples - Date toLocaleString() override:
`Date.prototype.toLocaleString()` is used to print out date displays more suitable for specific locales. For example:
Example:
const testDate = new Date();
// "Fri May 29 2020 18:04:24 GMT+0100 (British Summer Time)"
... | [
-0.46527335047721863,
0.12921084463596344,
-0.6369330286979675,
-0.11742974817752838,
0.2795826196670532,
-2.553952932357788,
-0.6015979647636414,
-0.5052438974380493,
0.13012464344501495,
0.0005229453672654927,
-1.1661536693572998,
1.0761327743530273,
-0.0594702810049057,
0.16602458059787... |
javascript/reference/global_objects/object/tolocalestring/index.md | JavaScript - Global Objects - Object - toLocaleString - Examples - Number toLocaleString() override:
`Number.prototype.toLocaleString()` is used to print out number displays more suitable for specific locales, e.g., with the correct separators. For example:
Example:
const testNumber = 2901234564;
// "2901234564"
co... | [
-0.627495288848877,
-0.003617348847910762,
-0.6121605038642883,
-0.6003264784812927,
0.07970444113016129,
-1.9964720010757446,
-0.5271463394165039,
-1.3184860944747925,
0.03937298059463501,
-0.056686967611312866,
-1.8113831281661987,
1.4501763582229614,
-0.8667066097259521,
0.1495055854320... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign:
The `Object.assign()` static method copies all `enumerable` `own properties` from one or more source objects to a target object. It returns the modified target object.
Example:
const target = { a: 1, b: 2 };
const source = { b: 4, c: 5 };
const returnedTarget = Object.... | [
-0.39002156257629395,
-0.33900225162506104,
-1.3579497337341309,
-0.14941464364528656,
-0.19457361102104187,
-1.7917479276657104,
0.4552588164806366,
0.1577262282371521,
0.041032660752534866,
-0.05798552557826042,
-0.5903316736221313,
0.21160759031772614,
-0.0916692391037941,
0.45498865842... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Syntax:
Example:
Object.assign(target)
Object.assign(target, source1)
Object.assign(target, source1, source2)
Object.assign(target, source1, source2, /* …, */ sourceN) | [
-0.5454283356666565,
0.26180627942085266,
-0.9006913304328918,
-0.5441586971282959,
-0.8038047552108765,
-2.4112377166748047,
0.29481253027915955,
0.21511448919773102,
-0.098012275993824,
-0.7262558341026306,
0.0074713509529829025,
-0.1754017025232315,
-0.7365107536315918,
-0.0040277848020... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Syntax - Parameters:
- `target`: The target object — what to apply the sources' properties to, which is returned after it is modified. If a primitive value is provided as the target, it will be converted to an object.
- `source1`, …, `sourceN`: The source object(s) — obj... | [
-0.12472238391637802,
0.12107303738594055,
-1.0094976425170898,
-0.1425049901008606,
-0.5071574449539185,
-2.39587140083313,
0.9339309930801392,
0.021659983322024345,
0.2410980761051178,
-0.5941426157951355,
-0.5829867124557495,
0.33526846766471863,
-0.8932304382324219,
0.11943517625331879... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Syntax - Return value:
The target object. | [
-0.04446125030517578,
0.028149167075753212,
-1.1570125818252563,
-0.5967607498168945,
-0.6342839598655701,
-1.6479558944702148,
0.648682177066803,
0.17909476161003113,
-0.1137937381863594,
-0.15344023704528809,
-0.48781320452690125,
0.8546825051307678,
-0.610090970993042,
1.087275862693786... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Syntax - Exceptions:
- `TypeError`: Thrown in one of the following cases:
- The `target` parameter is `null` or `undefined`.
- Assignment of a property on the target object fails; for example, because the property is non-writable on the target object, or because its ... | [
-0.6759199500083923,
0.016468744724988937,
-0.6900159120559692,
0.24635186791419983,
-0.1567135751247406,
-1.5242308378219604,
0.5653051137924194,
0.6522258520126343,
-0.09198842197656631,
-0.3914785385131836,
-0.21241040527820587,
-0.03751669451594353,
-0.46600306034088135,
0.090571194887... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Description:
Properties in the target object are overwritten by properties in the sources if they have the same `key`. Later sources' properties overwrite earlier ones.
The `Object.assign()` method only copies enumerable and own properties from a source object to a targ... | [
-0.8864142894744873,
-0.29285016655921936,
-1.2755507230758667,
0.3109544515609741,
-0.15088891983032227,
-2.0363657474517822,
0.8791428804397583,
0.03816086798906326,
0.0377156101167202,
-0.2784503996372223,
-0.9806017875671387,
0.3644264042377472,
-0.14511989057064056,
0.1523174941539764... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Examples - Cloning an object:
Example:
const obj = { a: 1 };
const copy = Object.assign({}, obj);
console.log(copy); // { a: 1 } | [
-0.2576473653316498,
0.1043061837553978,
-1.1553928852081299,
0.049686186015605927,
-0.5761951208114624,
-1.5095150470733643,
0.2506159543991089,
0.15632818639278412,
-0.11910784989595413,
-0.5538315176963806,
-0.11050756275653839,
0.15940633416175842,
-0.38097479939460754,
0.5076091885566... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Examples - Warning for deep clone:
For deep cloning, we need to use alternatives like `structuredClone()`, because `Object.assign()` copies property values.
If the source value is a reference to an object, it only copies the reference value.
Example:
const obj1 = { a:... | [
0.20649132132530212,
0.05303104594349861,
-0.8655254244804382,
0.9448039531707764,
0.48360133171081543,
-1.0906339883804321,
1.0597760677337646,
1.1634571552276611,
-0.5934210419654846,
0.43515467643737793,
-0.8391135931015015,
-0.3447381854057312,
-0.3193615972995758,
0.261645644903183,
... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Examples - Merging objects:
Example:
const o1 = { a: 1 };
const o2 = { b: 2 };
const o3 = { c: 3 };
const obj = Object.assign(o1, o2, o3);
console.log(obj); // { a: 1, b: 2, c: 3 }
console.log(o1); // { a: 1, b: 2, c: 3 }, target object itself is changed. | [
-0.280208945274353,
0.04176624119281769,
-1.2598474025726318,
-0.18738968670368195,
-0.17449302971363068,
-1.5555320978164673,
-0.04255123436450958,
-0.24754738807678223,
-0.2516906261444092,
-0.19361115992069244,
-0.16781973838806152,
-0.16731469333171844,
0.29828163981437683,
-0.19105824... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Examples - Merging objects with same properties:
Example:
const o1 = { a: 1, b: 1, c: 1 };
const o2 = { b: 2, c: 2 };
const o3 = { c: 3 };
const obj = Object.assign({}, o1, o2, o3);
console.log(obj); // { a: 1, b: 2, c: 3 }
The properties are overwritten by other obje... | [
-0.4480254650115967,
0.11753066629171371,
-1.2604105472564697,
-0.019335348159074783,
-0.012002191506326199,
-1.2722448110580444,
0.23201324045658112,
-0.10819403827190399,
-0.3966119885444641,
-0.5698758959770203,
-0.6399067640304565,
0.08829569071531296,
0.7062900066375732,
0.07631295174... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Examples - Copying symbol-typed properties:
Example:
const o1 = { a: 1 };
const o2 = { [Symbol("foo")]: 2 };
const obj = Object.assign({}, o1, o2);
console.log(obj); // { a : 1, [Symbol("foo")]: 2 } (cf. bug 1207182 on Firefox)
Object.getOwnPropertySymbols(obj); // [Sy... | [
-0.7940484285354614,
0.4518221616744995,
-0.7600640058517456,
0.11645638197660446,
-0.43647733330726624,
-2.01865291595459,
0.48464828729629517,
0.4711802303791046,
-0.21737296879291534,
-0.4506952166557312,
-0.6690683364868164,
0.17370302975177765,
-0.0927407369017601,
-0.4587883651256561... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Examples - Properties on the prototype chain and non-enumerable properties cannot be copied:
Example:
const obj = Object.create(
// foo is on obj's prototype chain.
{ foo: 1 },
{
bar: {
value: 2, // bar is a non-enumerable property.
},
baz: {
... | [
0.3648306429386139,
0.26817187666893005,
-0.6851404309272766,
0.16891252994537354,
-0.39949509501457214,
-2.1864027976989746,
0.3343226909637451,
0.4275543987751007,
-0.4999459981918335,
0.10010872036218643,
-0.7213885188102722,
0.15780839323997498,
-0.22879475355148315,
-0.256053209304809... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Examples - Primitives will be wrapped to objects:
Example:
const v1 = "abc";
const v2 = true;
const v3 = 10;
const v4 = Symbol("foo");
const obj = Object.assign({}, v1, null, v2, undefined, v3, v4);
// Primitives will be wrapped, null and undefined will be ignored.
// ... | [
-1.3370195627212524,
-0.036164768040180206,
-0.8307692408561707,
-0.07795030623674393,
-0.3815390169620514,
-1.9343842267990112,
0.9185076355934143,
-0.08234374970197678,
-0.14868378639221191,
0.12549206614494324,
-1.2427469491958618,
-0.4422897696495056,
-0.28257253766059875,
-0.353743046... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Examples - Exceptions will interrupt the ongoing copying task:
Example:
const target = Object.defineProperty({}, "foo", {
value: 1,
writable: false,
}); // target.foo is a read-only property
Object.assign(target, { bar: 2 }, { foo2: 3, foo: 3, foo3: 3 }, { baz: 4 }... | [
-0.4358908236026764,
0.19691668450832367,
-0.9469714164733887,
-0.10035853832960129,
0.030541980639100075,
-1.4938088655471802,
0.04491673409938812,
0.6330845355987549,
-0.12785176932811737,
-0.3769967257976532,
-0.7536506652832031,
-1.0581386089324951,
-0.43521517515182495,
-0.12848879396... |
javascript/reference/global_objects/object/assign/index.md | JavaScript - Global Objects - Object - assign - Examples - Copying accessors:
Example:
const obj = {
foo: 1,
get bar() {
return 2;
},
};
let copy = Object.assign({}, obj);
console.log(copy);
// { foo: 1, bar: 2 }
// The value of copy.bar is obj.bar's getter's return value.
// This is an assign function th... | [
-0.2064586728811264,
0.6450343728065491,
-0.9382269382476807,
0.25518694519996643,
0.5913589000701904,
-0.789682924747467,
-0.04821328446269035,
0.04948633164167404,
-0.0043568904511630535,
-0.30537381768226624,
-0.5787659287452698,
-0.19444990158081055,
-0.2955031096935272,
0.507358729839... |
javascript/reference/global_objects/object/__lookupsetter__/index.md | JavaScript - Global Objects - Object - lookupSetter:
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.9200543165206909,
-0.4641205370426178,
-1.2090908288955688,
0.23697040975093842,
-0.5014058351516724,
-1.829728603363037,
0.29732975363731384,
0.4954175353050232,
0.5409553647041321,
-0.15839052200317383,
-0.6403903365135193,
0.6241169571876526,
0.5074627995491028,
0.08711673319339752,
... |
javascript/reference/global_objects/object/__lookupsetter__/index.md | JavaScript - Global Objects - Object - lookupSetter - Syntax:
Example:
__lookupSetter__(prop) | [
-0.5271440148353577,
-0.3490355610847473,
-1.366764783859253,
-0.1834222972393036,
-0.9426529407501221,
-1.9756687879562378,
-0.030842389911413193,
1.2792223691940308,
0.47189295291900635,
-0.5436066389083862,
-0.4195725619792938,
0.5928205847740173,
0.20724454522132874,
0.0337726473808288... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.