file stringlengths 16 94 | text stringlengths 32 24.4k | vector list |
|---|---|---|
javascript/reference/global_objects/arraybuffer/maxbytelength/index.md | JavaScript - Global Objects - ArrayBuffer - maxByteLength - Examples - Using maxByteLength:
In this example, we create an 8-byte buffer that is resizable to a max length of 16 bytes, then return its `maxByteLength`:
Example:
const buffer = new ArrayBuffer(8, { maxByteLength: 16 });
buffer.maxByteLength; // 16 | [
-0.5001354813575745,
-0.23906706273555756,
-1.0109503269195557,
0.518919050693512,
-0.5323725938796997,
-1.264357566833496,
0.3049219846725464,
0.16057351231575012,
0.48168525099754333,
-0.4123539924621582,
-1.026388168334961,
0.8496814966201782,
-0.23280999064445496,
-0.0681660994887352,
... |
javascript/reference/global_objects/arraybuffer/detached/index.md | JavaScript - Global Objects - ArrayBuffer - detached:
The `detached` accessor property of `ArrayBuffer` instances returns a boolean indicating whether or not this buffer has been detached (transferred). | [
0.21171215176582336,
-0.5284417271614075,
-1.6653982400894165,
1.033089280128479,
-0.9331727027893066,
-2.0857203006744385,
1.2179601192474365,
0.8622546195983887,
0.13399209082126617,
0.4203300476074219,
-1.0536006689071655,
-0.3157651424407959,
-0.5742945671081543,
1.0471265316009521,
... |
javascript/reference/global_objects/arraybuffer/detached/index.md | JavaScript - Global Objects - ArrayBuffer - detached - Description:
The `detached` property is an accessor property whose set accessor function is `undefined`, meaning that you can only read this property. The value is `false` when the `ArrayBuffer` is first created. The value becomes `true` if the `ArrayBuffer` is tr... | [
0.2569248378276825,
-0.031470995396375656,
-1.3001182079315186,
0.6030912399291992,
-0.6317198276519775,
-2.224350690841675,
1.1913574934005737,
0.9141462445259094,
0.8674904108047485,
0.3437509536743164,
-0.5614601969718933,
-0.6613403558731079,
-0.8397545218467712,
0.578666090965271,
0... |
javascript/reference/global_objects/arraybuffer/detached/index.md | JavaScript - Global Objects - ArrayBuffer - detached - Examples - Using detached:
Example:
const buffer = new ArrayBuffer(8);
console.log(buffer.detached); // false
const newBuffer = buffer.transfer();
console.log(buffer.detached); // true
console.log(newBuffer.detached); // false | [
0.5556880235671997,
-0.12274874001741409,
-1.3074555397033691,
0.23300117254257202,
-0.758169412612915,
-2.054727077484131,
0.6846344470977783,
0.7717753648757935,
0.3390949070453644,
0.19732534885406494,
-0.5456146597862244,
0.17605844140052795,
-0.46479111909866333,
0.38736775517463684,
... |
javascript/reference/global_objects/boolean/index.md | JavaScript - Global Objects - Boolean:
`Boolean` values can be one of two values: `true` or `false`, representing the truth value of a logical proposition. | [
-0.6714357137680054,
-0.03792589157819748,
-0.563089907169342,
-0.19182927906513214,
-0.7360166907310486,
-1.8005719184875488,
0.28520750999450684,
1.100340723991394,
0.3028581738471985,
-0.826705276966095,
-1.1733734607696533,
-0.10149595886468887,
0.6574022173881531,
-0.5769175291061401,... |
javascript/reference/global_objects/boolean/index.md | JavaScript - Global Objects - Boolean - Description:
Boolean values are typically produced by relational operators, equality operators, and logical NOT (`!`). They can also be produced by functions that represent conditions, such as `Array.isArray()`. Note that binary logical operators such as `&&` and `||` return the... | [
-0.8377442359924316,
-0.09325024485588074,
-1.1493076086044312,
0.6198590993881226,
-0.12168289721012115,
-0.9241354465484619,
0.0057101743295788765,
0.7336410284042358,
-0.0022051152773201466,
-0.3279069662094116,
-1.266722321510315,
-0.19411547482013702,
1.2359434366226196,
-0.3137371242... |
javascript/reference/global_objects/boolean/index.md | JavaScript - Global Objects - Boolean - Description - Boolean primitives and Boolean objects:
For converting non-boolean values to boolean, use `Boolean` as a function or use the double NOT operator. Do not use the `Boolean()` constructor with `new`.
Example:
const good = Boolean(expression);
const good2 = !!express... | [
-0.7133799195289612,
0.21177296340465546,
-0.968864381313324,
0.7424553036689758,
-0.138514906167984,
-1.6874862909317017,
-0.2656979262828827,
0.5595269799232483,
0.36262497305870056,
0.10496695339679718,
-1.1110424995422363,
0.08907268941402435,
0.8903941512107849,
-0.719292938709259,
... |
javascript/reference/global_objects/boolean/index.md | JavaScript - Global Objects - Boolean - Description - Boolean coercion:
Many built-in operations that expect booleans first coerce their arguments to booleans. The operation can be summarized as follows:
- Booleans are returned as-is.
- `undefined` turns into `false`.
- `null` turns into `false`.
- `0`, `-0`, and `Na... | [
-0.35507291555404663,
-0.04714035615324974,
-0.39656755328178406,
0.7325655221939087,
0.7141854166984558,
-0.4522804021835327,
0.618850827217102,
0.7842819690704346,
-0.40216130018234253,
-0.3445360064506531,
-0.7786574363708496,
-0.20344462990760803,
-0.24402275681495667,
0.32729554176330... |
javascript/reference/global_objects/boolean/index.md | JavaScript - Global Objects - Boolean - Constructor:
- `Boolean()`: Creates `Boolean` objects. When called as a function, it returns primitive values of type Boolean. | [
-0.9445309638977051,
0.32583844661712646,
-1.2512112855911255,
0.04575755447149277,
-0.2338929921388626,
-1.4162399768829346,
0.433259516954422,
1.0548335313796997,
-0.5481842160224915,
-0.2884521484375,
-1.3489022254943848,
0.2415098398923874,
0.4481239914894104,
-0.06716150790452957,
0... |
javascript/reference/global_objects/boolean/index.md | JavaScript - Global Objects - Boolean - Instance properties:
These properties are defined on `Boolean.prototype` and shared by all `Boolean` instances.
- `Boolean.prototype.constructor`: The constructor function that created the instance object. For `Boolean` instances, the initial value is the `Boolean` constructor. | [
-0.1984604001045227,
-0.2754603326320648,
-0.8024013042449951,
0.40987005829811096,
0.008851864375174046,
-1.5984835624694824,
0.045290250331163406,
0.7157300710678101,
0.47430580854415894,
-0.5367035865783691,
-1.347579002380371,
0.37310487031936646,
0.2350713014602661,
0.2928961217403412... |
javascript/reference/global_objects/boolean/index.md | JavaScript - Global Objects - Boolean - Instance methods:
- `Boolean.prototype.toString()`: Returns a string of either `true` or `false` depending upon the value of the object. Overrides the `Object.prototype.toString()` method.
- `Boolean.prototype.valueOf()`: Returns the primitive value of the `Boolean` object. Over... | [
-0.7180958390235901,
-0.5505955815315247,
-0.17683754861354828,
-0.10331717878580093,
-0.14525510370731354,
-1.7330466508865356,
1.077531099319458,
0.32917600870132446,
-0.1531415581703186,
-0.9130364656448364,
-1.3674397468566895,
0.5687465667724609,
0.7443901300430298,
-0.313655406236648... |
javascript/reference/global_objects/boolean/index.md | JavaScript - Global Objects - Boolean - Examples - Creating false values:
Example:
const bNoParam = Boolean();
const bZero = Boolean(0);
const bNull = Boolean(null);
const bEmptyString = Boolean("");
const bfalse = Boolean(false); | [
-0.5443298816680908,
0.22140547633171082,
-0.4562795162200928,
0.6058408617973328,
-0.38557127118110657,
-1.1777931451797485,
0.8395190238952637,
1.3403609991073608,
-0.7159445285797119,
-0.09640265256166458,
-1.0139586925506592,
-0.0068343146704137325,
0.6442789435386658,
-0.7519071698188... |
javascript/reference/global_objects/boolean/index.md | JavaScript - Global Objects - Boolean - Examples - Creating true values:
Example:
const btrue = Boolean(true);
const btrueString = Boolean("true");
const bfalseString = Boolean("false");
const bSuLin = Boolean("Su Lin");
const bArrayProto = Boolean([]);
const bObjProto = Boolean({}); | [
-0.44995149970054626,
-0.0379578061401844,
-0.6757379770278931,
0.34157007932662964,
-0.37367671728134155,
-1.1552330255508423,
0.08395928889513016,
0.6479377150535583,
-0.032774701714515686,
0.10852921009063721,
-0.43597277998924255,
0.5138787031173706,
1.018520474433899,
-0.6005753278732... |
javascript/reference/global_objects/boolean/tostring/index.md | JavaScript - Global Objects - Boolean - toString:
The `toString()` method of `Boolean` values returns a string representing the specified boolean value.
Example:
const flag1 = new Boolean(true);
console.log(flag1.toString());
// Expected output: "true"
const flag2 = new Boolean(1);
console.log(flag2.toString());
... | [
-1.0761116743087769,
-0.00022787008492741734,
-0.9580458402633667,
-0.012752103619277477,
-0.18386656045913696,
-2.5072474479675293,
-0.03316381573677063,
0.4578586518764496,
-0.32891157269477844,
-0.7067090272903442,
-0.6396012902259827,
0.47112590074539185,
0.7185764908790588,
0.13596662... |
javascript/reference/global_objects/boolean/tostring/index.md | JavaScript - Global Objects - Boolean - toString - Syntax:
Example:
toString() | [
-0.940150260925293,
0.3462778627872467,
-0.5287281274795532,
-0.07727914303541183,
-0.47249487042427063,
-2.2165040969848633,
0.4014153480529785,
0.305416077375412,
-0.21328498423099518,
-1.2280961275100708,
-0.42526406049728394,
0.4279605448246002,
0.14177154004573822,
-0.3908531367778778... |
javascript/reference/global_objects/boolean/tostring/index.md | JavaScript - Global Objects - Boolean - toString - Syntax - Parameters:
None. | [
-0.7036259174346924,
0.35590237379074097,
-0.6843363046646118,
-0.5771465301513672,
-0.5117787718772888,
-1.841316819190979,
0.669465184211731,
0.47711774706840515,
-0.2855663001537323,
-1.1760213375091553,
-0.9384866952896118,
-0.35636645555496216,
0.24972648918628693,
-0.1659124791622162... |
javascript/reference/global_objects/boolean/tostring/index.md | JavaScript - Global Objects - Boolean - toString - Syntax - Return value:
A string representing the specified boolean value. | [
-0.6063377261161804,
-0.19329211115837097,
-0.6500995755195618,
-0.1189039871096611,
-0.4980381429195404,
-2.299926519393921,
0.4504457712173462,
0.8266980648040771,
-0.2461964190006256,
-0.6395708918571472,
-0.6178685426712036,
0.9910063743591309,
-0.051952216774225235,
0.7252473831176758... |
javascript/reference/global_objects/boolean/tostring/index.md | JavaScript - Global Objects - Boolean - toString - Description:
The `Boolean` object overrides the `toString` method of `Object`; it does not inherit `Object.prototype.toString()`. For `Boolean` values, the `toString` method returns a string representation of the boolean value, which is either `"true"` or `"false"`.
... | [
0.1275233030319214,
0.09323324263095856,
-0.5388635396957397,
0.6855854988098145,
0.7242669463157654,
-1.1805284023284912,
0.5588963031768799,
0.4606795907020569,
-0.6307656168937683,
-0.5120224952697754,
-0.6321209073066711,
0.24961647391319275,
0.02956836298108101,
0.2756815254688263,
... |
javascript/reference/global_objects/boolean/tostring/index.md | JavaScript - Global Objects - Boolean - toString - Examples - Using toString():
Example:
const flag = new Boolean(true);
console.log(flag.toString()); // "true"
console.log(false.toString()); // "false" | [
-0.49699705839157104,
0.3834879696369171,
-0.6240805983543396,
0.26384422183036804,
-0.4473498463630676,
-2.494973659515381,
0.17413486540317535,
0.15753892064094543,
-0.005530128721147776,
-0.7674229145050049,
-0.41894376277923584,
0.15382836759090424,
0.4026695489883423,
-0.0841721817851... |
javascript/reference/global_objects/boolean/boolean/index.md | JavaScript - Global Objects - Boolean:
The `Boolean()` constructor creates `Boolean` objects. When called as a function, it returns primitive values of type Boolean.
Example:
const flag = new Boolean();
console.log(typeof flag);
// Expected output: object
console.log(flag === false);
// Expected output: false
const... | [
-0.18890051543712616,
0.16979433596134186,
-1.4187852144241333,
0.4580724835395813,
-0.2984394431114197,
-1.8433805704116821,
-0.35755959153175354,
0.992296576499939,
-0.22080710530281067,
-0.23592782020568848,
-0.9532518982887268,
0.22114603221416473,
0.34786421060562134,
-0.2577123939990... |
javascript/reference/global_objects/boolean/boolean/index.md | JavaScript - Global Objects - Boolean - Syntax:
Example:
new Boolean(value)
Boolean(value)
Note: `Boolean()` can be called with or without `new`, but with different effects. See Return value. | [
-0.06416014581918716,
0.5287462472915649,
-0.8352972269058228,
-0.09051872789859772,
-0.5432417988777161,
-1.982374668121338,
0.2094726264476776,
1.430717945098877,
0.08984911441802979,
-0.7496041059494019,
-0.47055497765541077,
0.9759619235992432,
0.47849947214126587,
0.024969588965177536... |
javascript/reference/global_objects/boolean/boolean/index.md | JavaScript - Global Objects - Boolean - Syntax - Parameters:
- `value`: The initial value of the `Boolean` object. | [
0.39826270937919617,
0.6088172793388367,
-1.0063132047653198,
-0.11464744806289673,
-0.40494343638420105,
-1.5852419137954712,
1.2641537189483643,
1.290799617767334,
0.11268636584281921,
-1.0118200778961182,
-0.9598920941352844,
0.36951789259910583,
0.10201370716094971,
0.06497277319431305... |
javascript/reference/global_objects/boolean/boolean/index.md | JavaScript - Global Objects - Boolean - Syntax - Return value:
When `Boolean()` is called as a function (without `new`), it returns `value` coerced to a boolean primitive.
When `Boolean()` is called as a constructor (with `new`), it coerces `value` to a boolean primitive and returns a wrapping `Boolean` object, which... | [
-0.40292298793792725,
0.7490391731262207,
-0.6017217040061951,
0.016013190150260925,
-0.4929502010345459,
-1.5613495111465454,
0.6412563920021057,
1.4885239601135254,
-0.6666868925094604,
0.2273789495229721,
-0.7878347039222717,
0.4030452072620392,
0.17596803605556488,
0.11451593786478043,... |
javascript/reference/global_objects/boolean/boolean/index.md | JavaScript - Global Objects - Boolean - Description:
The value passed as the first parameter is converted to a boolean value. If the value is omitted or is `0`, `-0`, `0n`, `null`, `false`, `NaN`, `undefined`, or the empty string (`""`), then the object has an initial value of `false`. All other values, including any ... | [
-0.24687407910823822,
0.598816454410553,
-0.8499953746795654,
0.9889888763427734,
-0.1718735545873642,
-1.6616542339324951,
1.244761347770691,
0.8039882183074951,
-0.3635406494140625,
-0.3565590977668762,
-0.9613960385322571,
-0.3804137408733368,
0.4387751817703247,
-0.3244781792163849,
... |
javascript/reference/global_objects/boolean/boolean/index.md | JavaScript - Global Objects - Boolean - Examples - Creating Boolean objects with an initial value of false:
Example:
const bZero = new Boolean(0);
const bNull = new Boolean(null);
const bEmptyString = new Boolean("");
const bfalse = new Boolean(false);
typeof bfalse; // "object"
Boolean(bfalse); // true
Note how co... | [
-0.6783966422080994,
0.4745986759662628,
-0.8928287625312805,
0.6589774489402771,
-0.045739561319351196,
-1.262040138244629,
1.4306265115737915,
1.014117956161499,
-0.015821078792214394,
-0.41480857133865356,
-1.1242388486862183,
0.041246600449085236,
0.6875555515289307,
-0.561871051788330... |
javascript/reference/global_objects/boolean/boolean/index.md | JavaScript - Global Objects - Boolean - Examples - Creating `Boolean` objects with an initial value of `true`:
Example:
const btrue = new Boolean(true);
const btrueString = new Boolean("true");
const bfalseString = new Boolean("false");
const bSuLin = new Boolean("Su Lin");
const bArrayProto = new Boolean([]);
const ... | [
-0.30492860078811646,
0.07078465074300766,
-0.6853594779968262,
0.6586346626281738,
-0.264412522315979,
-1.1385512351989746,
0.17901834845542908,
0.671990156173706,
-0.2722463607788086,
-0.16620561480522156,
-0.6538532972335815,
0.017365582287311554,
0.9569266438484192,
-0.4414862096309662... |
javascript/reference/global_objects/boolean/valueof/index.md | JavaScript - Global Objects - Boolean - valueOf:
The `valueOf()` method of `Boolean` values returns the primitive value of a `Boolean` object.
Example:
const x = new Boolean();
console.log(x.valueOf());
// Expected output: false
const y = new Boolean("Mozilla");
console.log(y.valueOf());
// Expected output: true | [
-0.3484286665916443,
-0.366702139377594,
-1.0030200481414795,
-0.0033647585660219193,
-0.025413090363144875,
-0.7732154726982117,
0.4977106750011444,
0.6845451593399048,
0.3900968134403229,
-0.5447144508361816,
-0.7152295708656311,
0.265749454498291,
0.664412796497345,
0.255461186170578,
... |
javascript/reference/global_objects/boolean/valueof/index.md | JavaScript - Global Objects - Boolean - valueOf - Syntax:
Example:
valueOf() | [
0.2747553288936615,
0.05865978077054024,
-0.6238518953323364,
-0.25469642877578735,
-0.4370293915271759,
-1.456207275390625,
0.9209944605827332,
0.9465923309326172,
0.42986980080604553,
-1.2586455345153809,
-0.6856511831283569,
0.6406852006912231,
0.04324876144528389,
0.1595667153596878,
... |
javascript/reference/global_objects/boolean/valueof/index.md | JavaScript - Global Objects - Boolean - valueOf - Syntax - Parameters:
None. | [
0.08215698599815369,
0.4238619804382324,
-1.0353493690490723,
-0.5024629831314087,
-0.5130564570426941,
-1.2955468893051147,
1.0356485843658447,
0.8841894268989563,
0.06343702226877213,
-1.217568278312683,
-1.0295058488845825,
-0.21876168251037598,
0.17088058590888977,
0.1290665715932846,
... |
javascript/reference/global_objects/boolean/valueof/index.md | JavaScript - Global Objects - Boolean - valueOf - Syntax - Return value:
The primitive value of the given `Boolean` object. | [
-0.21459123492240906,
0.2487303912639618,
-0.6037554740905762,
-0.615863025188446,
-0.4501073360443115,
-1.1139771938323975,
1.3172271251678467,
1.1075644493103027,
0.11350300163030624,
-0.6338214874267578,
-1.2335350513458252,
0.8848459720611572,
-0.34353673458099365,
0.957102358341217,
... |
javascript/reference/global_objects/boolean/valueof/index.md | JavaScript - Global Objects - Boolean - valueOf - Description:
The `valueOf()` method of `Boolean` returns the primitive value of a `Boolean` object or literal `Boolean` as a Boolean data type.
This method is usually called internally by JavaScript and not explicitly in code. | [
-0.8318970799446106,
-0.0447089821100235,
-0.9471991658210754,
-0.09704753011465073,
-0.03773529455065727,
-1.0476038455963135,
1.5508837699890137,
0.7775617241859436,
-0.21473057568073273,
-0.5071263313293457,
-1.3027430772781372,
0.8685843348503113,
0.41835322976112366,
0.166201397776603... |
javascript/reference/global_objects/boolean/valueof/index.md | JavaScript - Global Objects - Boolean - valueOf - Examples - Using `valueOf()`:
Example:
const x = new Boolean();
const myVar = x.valueOf(); // assigns false to myVar | [
-0.3735840916633606,
-0.05345030128955841,
-0.7890502214431763,
0.5634777545928955,
-0.543491005897522,
-0.9824805855751038,
0.8793774843215942,
0.5398938059806824,
0.39488497376441956,
-0.836665153503418,
-0.8319792747497559,
-0.03122173622250557,
0.30208197236061096,
0.27430257201194763,... |
javascript/reference/global_objects/undefined/index.md | JavaScript - Global Objects - undefined:
The `undefined` global property represents the primitive value `undefined`. It is one of JavaScript's `primitive types`.
Example:
function test(t) {
if (t === undefined) {
return "Undefined value!";
}
return t;
}
let x;
console.log(test(x));
// Expected output: "U... | [
-1.5765091180801392,
0.346664160490036,
-0.905990719795227,
-0.1713058054447174,
-0.22246100008487701,
-1.5134861469268799,
0.9852015972137451,
0.743059515953064,
-0.309291809797287,
0.04581448808312416,
-0.48524782061576843,
0.028535932302474976,
-0.510539174079895,
-0.31534770131111145,
... |
javascript/reference/global_objects/undefined/index.md | JavaScript - Global Objects - undefined - Value:
The primitive value `undefined`. | [
-0.7084122896194458,
0.4912031888961792,
-0.609473466873169,
-0.9349724054336548,
-0.7655991911888123,
-1.1958693265914917,
1.594638466835022,
1.0194356441497803,
0.2503896653652191,
-0.17794042825698853,
-0.5124577879905701,
-0.5976545214653015,
-0.7582587003707886,
-0.17900295555591583,
... |
javascript/reference/global_objects/undefined/index.md | JavaScript - Global Objects - undefined - Description:
`undefined` is a property of the global object. That is, it is a variable in global scope.
In all non-legacy browsers, `undefined` is a non-configurable, non-writable property. Even when this is not the case, avoid overriding it.
A variable that has not been ass... | [
-1.119726538658142,
0.23734089732170105,
-0.8981544375419617,
0.09707629680633545,
-0.4167962968349457,
-1.4871705770492554,
0.799206554889679,
0.2791972756385803,
0.07726505398750305,
0.11329805850982666,
-0.426842600107193,
-0.05498775094747543,
-0.11607737839221954,
-0.08214204758405685... |
javascript/reference/global_objects/undefined/index.md | JavaScript - Global Objects - undefined - Examples - Strict equality and undefined:
You can use `undefined` and the strict equality and inequality operators to determine whether a variable has a value. In the following code, the variable `x` is not initialized, and the `if` statement evaluates to true.
Example:
let ... | [
-1.2452483177185059,
0.1220797449350357,
-1.0987217426300049,
0.6847331523895264,
-0.09447398036718369,
-0.8563647270202637,
1.6930891275405884,
0.6952161192893982,
0.4208123981952667,
0.40368810296058655,
-0.6973470449447632,
-0.9382978081703186,
-0.05552659183740616,
-0.32743576169013977... |
javascript/reference/global_objects/undefined/index.md | JavaScript - Global Objects - undefined - Examples - typeof operator and undefined:
`typeof` can also determine whether a variable is `undefined`:
Example:
let x;
if (typeof x === "undefined") {
// these statements execute
}
One reason to use `typeof` is that it does not throw an error if the variable does not ex... | [
-0.5030653476715088,
0.008056006394326687,
-0.7198464274406433,
0.983065664768219,
0.3072148859500885,
0.2171662151813507,
-0.050885602831840515,
0.2788139879703522,
-0.012784920632839203,
-0.22900919616222382,
-0.45767608284950256,
-0.18851952254772186,
0.16768845915794373,
0.370279252529... |
javascript/reference/global_objects/undefined/index.md | JavaScript - Global Objects - undefined - Examples - void operator and undefined:
The `void` operator can also be used to produce the `undefined` value. This is very commonly seen in minified code because `void 0` is 3 bytes shorter and cannot be overridden. You should usually avoid this pattern in your own code.
Exa... | [
-1.0272573232650757,
1.0110809803009033,
-1.196123719215393,
0.6169212460517883,
0.5590627193450928,
-0.6872343420982361,
0.5487849116325378,
1.7059365510940552,
-0.12188100814819336,
0.16898834705352783,
-1.1865360736846924,
-0.8988041281700134,
0.5724001526832581,
-0.5718135833740234,
... |
javascript/reference/global_objects/encodeuri/index.md | JavaScript - Global Objects - encodeURI:
The `encodeURI()` function encodes a `URI` by replacing each instance of certain characters by one, two, three, or four escape sequences representing the `UTF-8` encoding of the character (will only be four escape sequences for characters composed of two surrogate characters). ... | [
0.1743166595697403,
-0.2968430519104004,
-0.49877479672431946,
0.12536552548408508,
-0.4166982173919678,
-1.3452080488204956,
-0.27065128087997437,
0.36338263750076294,
-0.38807061314582825,
-0.7423378229141235,
-0.9133846163749695,
-0.1073833554983139,
0.11129521578550339,
-0.206559002399... |
javascript/reference/global_objects/encodeuri/index.md | JavaScript - Global Objects - encodeURI - Syntax:
Example:
encodeURI(uri) | [
0.5962842106819153,
0.49809688329696655,
-0.6350064277648926,
-0.21072286367416382,
-1.5198005437850952,
-1.5327445268630981,
0.03711117431521416,
1.295328140258789,
-0.29807478189468384,
-0.9526280164718628,
-0.7962942719459534,
0.5093103051185608,
0.3392872214317322,
-0.21184828877449036... |
javascript/reference/global_objects/encodeuri/index.md | JavaScript - Global Objects - encodeURI - Syntax - Parameters:
- `uri`: A string to be encoded as a URI. | [
0.6515111923217773,
0.4212386906147003,
-0.6020863056182861,
-0.13404200971126556,
-1.0329784154891968,
-1.675740361213684,
-0.1859540492296219,
1.0965577363967896,
0.3417057991027832,
-0.5894655585289001,
-1.2527252435684204,
0.2653368413448334,
0.2849861681461334,
0.37833306193351746,
... |
javascript/reference/global_objects/encodeuri/index.md | JavaScript - Global Objects - encodeURI - Syntax - Return value:
A new string representing the provided string encoded as a URI. | [
-0.12601812183856964,
-0.17439627647399902,
-0.4760679602622986,
-0.24759835004806519,
-0.9851617217063904,
-1.8881796598434448,
0.13829363882541656,
1.4016103744506836,
0.11244073510169983,
-0.05487514287233353,
-0.8771637082099915,
0.475320428609848,
0.1615275889635086,
1.115523338317871... |
javascript/reference/global_objects/encodeuri/index.md | JavaScript - Global Objects - encodeURI - Syntax - Exceptions:
- `URIError`: Thrown if `uri` contains a lone surrogate. | [
-0.45058736205101013,
1.0022327899932861,
-0.5701727271080017,
0.2213311493396759,
-1.109310269355774,
-1.3617247343063354,
-0.2480155974626541,
1.4169971942901611,
-0.7292593121528625,
-0.5426934957504272,
-0.7073225378990173,
-0.22085322439670563,
0.06051061674952507,
-0.0620769783854484... |
javascript/reference/global_objects/encodeuri/index.md | JavaScript - Global Objects - encodeURI - Description:
`encodeURI()` is a function property of the global object.
The `encodeURI()` function escapes characters by UTF-8 code units, with each octet encoded in the format `%XX`, left-padded with 0 if necessary. Because lone surrogates in UTF-16 do not encode any valid U... | [
-0.2650523781776428,
0.7110541462898254,
-0.07485245913267136,
0.8290442824363708,
0.3932315707206726,
-0.39673978090286255,
-0.46394816040992737,
0.2046406865119934,
-0.2553028166294098,
-0.4836907386779785,
-0.41346409916877747,
0.4155955910682678,
-0.2826831340789795,
0.5901850461959839... |
javascript/reference/global_objects/encodeuri/index.md | JavaScript - Global Objects - encodeURI - Examples - encodeURI() vs. encodeURIComponent():
`encodeURI()` differs from `encodeURIComponent()` as follows:
Example:
const set1 = ";/?:@&=+$,#"; // Reserved Characters
const set2 = "-.!~*'()"; // Unreserved Marks
const set3 = "ABC abc 123"; // Alphanumeric Characters + Sp... | [
0.14489267766475677,
-0.36666882038116455,
-0.5911484360694885,
0.2089153230190277,
0.2548542618751526,
-0.775122344493866,
0.2553405463695526,
0.6827391982078552,
0.006567878648638725,
-0.28266310691833496,
-0.7003734707832336,
-0.05528683215379715,
-0.4348590672016144,
0.0966756343841552... |
javascript/reference/global_objects/encodeuri/index.md | JavaScript - Global Objects - encodeURI - Examples - Encoding a lone surrogate throws:
A `URIError` will be thrown if one attempts to encode a surrogate which is not part of a high-low pair. For example:
Example:
// High-low pair OK
encodeURI("\uD800\uDFFF"); // "%F0%90%8F%BF"
// Lone high-surrogate code unit throw... | [
-0.7357550263404846,
1.2344309091567993,
-0.8189008235931396,
0.1265902817249298,
-0.42733508348464966,
-0.6892044544219971,
0.39595144987106323,
1.1195652484893799,
-1.3298594951629639,
-0.44046705961227417,
-1.0478390455245972,
-0.23937654495239258,
0.14993871748447418,
-0.19924247264862... |
javascript/reference/global_objects/encodeuri/index.md | JavaScript - Global Objects - encodeURI - Examples - Encoding for RFC3986:
The more recent RFC3986 makes square brackets reserved (for `IPv6`) and thus not encoded when forming something which could be part of a URL (such as a host). It also reserves !, ', (, ), and , even though these characters have no formalized UR... | [
-0.9111568331718445,
0.7957360744476318,
-0.23673580586910248,
-0.13439926505088806,
-0.3114447295665741,
-0.8904716372489929,
0.0776190236210823,
-0.4766577184200287,
-0.4127993881702423,
-0.9370228052139282,
-0.9061816334724426,
0.45206162333488464,
-0.5573199987411499,
-0.39083641767501... |
javascript/reference/global_objects/object/setprototypeof/index.md | JavaScript - Global Objects - Object - setPrototypeOf:
The `Object.setPrototypeOf()` static method sets the prototype (i.e., the internal `[[Prototype]]` property) of a specified object to another object or `null`.
Warning: Changing the `[[Prototype]]` of an object is, by the nature of how modern JavaScript engines o... | [
0.74703049659729,
-0.26679113507270813,
-0.9384680390357971,
1.2987949848175049,
0.7090764045715332,
-0.9437429308891296,
-0.1224207803606987,
0.6503148078918457,
-0.050122588872909546,
-0.45790672302246094,
-1.1221479177474976,
0.8150836825370789,
0.4048575758934021,
0.25848180055618286,
... |
javascript/reference/global_objects/object/setprototypeof/index.md | JavaScript - Global Objects - Object - setPrototypeOf - Syntax:
Example:
Object.setPrototypeOf(obj, prototype) | [
-0.5146811604499817,
-0.12947143614292145,
-0.618364155292511,
-0.1514190137386322,
-0.6737803220748901,
-1.163343906402588,
-0.20853865146636963,
0.73924720287323,
0.5457208156585693,
-0.6377102732658386,
-0.7123691439628601,
0.03566751256585121,
0.2261437177658081,
-0.008119858801364899,... |
javascript/reference/global_objects/object/setprototypeof/index.md | JavaScript - Global Objects - Object - setPrototypeOf - Syntax - Parameters:
- `obj`: The object which is to have its prototype set.
- `prototype`: The object's new prototype (an object or `null`). | [
-0.7148476839065552,
-0.24628470838069916,
-1.1066852807998657,
-0.04248632863163948,
-0.08105665445327759,
-1.269940733909607,
-0.22178229689598083,
0.3773161768913269,
0.7200517058372498,
-0.4115526080131531,
-1.161446452140808,
0.17054367065429688,
-0.05215178802609444,
0.48875433206558... |
javascript/reference/global_objects/object/setprototypeof/index.md | JavaScript - Global Objects - Object - setPrototypeOf - Syntax - Return value:
The specified object. | [
-0.32778632640838623,
-0.45864906907081604,
-0.845958411693573,
-0.16325166821479797,
-0.5548082590103149,
-1.2545580863952637,
0.19371263682842255,
0.7332839965820312,
-0.05506867170333862,
-0.36349228024482727,
-0.8757484555244446,
0.9464219808578491,
0.08481474965810776,
0.7903061509132... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.