file stringlengths 16 94 | text stringlengths 32 24.4k | vector list |
|---|---|---|
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... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.