file
stringlengths
16
94
text
stringlengths
32
24.4k
vector
list
javascript/reference/global_objects/json/stringify/index.md
JavaScript - Global Objects - JSON - stringify - Description - The space parameter: The `space` parameter may be used to control spacing in the final string. - If it is a number, successive levels in the stringification will each be indented by this many space characters. - If it is a string, successive levels will b...
[ -1.1709740161895752, -0.1748163253068924, -0.7050759792327881, -0.7916892766952515, -0.03741985931992531, -1.9232338666915894, 0.449988454580307, -0.21709538996219635, 0.2877582609653473, 0.03559088706970215, -0.6150047779083252, 0.37004992365837097, 0.20619530975818634, -0.088769391179084...
javascript/reference/global_objects/json/stringify/index.md
JavaScript - Global Objects - JSON - stringify - Examples - Using JSON.stringify: Example: JSON.stringify({}); // '{}' JSON.stringify(true); // 'true' JSON.stringify("foo"); // '"foo"' JSON.stringify([1, "false", false]); // '[1,"false",false]' JSON.stringify([NaN, null, Infinity]); // '[null,null,null]' JSON.stringi...
[ 0.3732145130634308, -0.2882787585258484, -1.1272541284561157, 0.2085358202457428, 0.4859546422958374, -0.6503943204879761, 0.33292824029922485, 0.7355482578277588, 0.07281764596700668, -0.3266996145248413, -0.21656711399555206, -0.05142201855778694, -0.432512491941452, 0.595328688621521, ...
javascript/reference/global_objects/json/stringify/index.md
JavaScript - Global Objects - JSON - stringify - Examples - Using a function as replacer: Example: function replacer(key, value) { // Filtering out properties if (typeof value === "string") { return undefined; } return value; } const foo = { foundation: "Mozilla", model: "box", week: 45, transpor...
[ -0.3184148967266083, -0.26072174310684204, -0.8766387104988098, 0.2412073314189911, 0.1790744811296463, -1.7838279008865356, 0.7096935510635376, 1.0354384183883667, -0.4869129955768585, 0.31758779287338257, 0.18706350028514862, -0.8872167468070984, -0.36039018630981445, 0.08001971244812012...
javascript/reference/global_objects/json/stringify/index.md
JavaScript - Global Objects - JSON - stringify - Examples - Using an array as replacer: Example: const foo = { foundation: "Mozilla", model: "box", week: 45, transport: "car", month: 7, }; JSON.stringify(foo, ["week", "month"]); // '{"week":45,"month":7}', only keep "week" and "month" properties
[ -0.33575400710105896, -0.5994443893432617, -0.7699212431907654, 0.008623803965747356, -0.677388072013855, -2.206890344619751, 0.00839089322835207, 0.5621890425682068, -0.3182196617126465, 0.15506546199321747, 0.22268569469451904, -0.4159232974052429, 0.04274173080921173, 0.0251554027199745...
javascript/reference/global_objects/json/stringify/index.md
JavaScript - Global Objects - JSON - stringify - Examples - Using the space parameter: Indent the output with one space: Example: console.log(JSON.stringify({ a: 2 }, null, " ")); /* { "a": 2 } */ Using a tab character mimics standard pretty-print appearance: Example: console.log(JSON.stringify({ uno: 1, dos: 2 ...
[ -1.3509236574172974, 0.2799149453639984, -1.0877481698989868, -0.3059694468975067, -0.2870135009288788, -1.3499228954315186, 0.24498869478702545, 0.39356425404548645, 0.47158756852149963, 0.08649902790784836, -0.1907707303762436, 0.3300619423389435, 0.5519552826881409, -0.5232005715370178,...
javascript/reference/global_objects/json/stringify/index.md
JavaScript - Global Objects - JSON - stringify - Examples - toJSON() behavior: Defining `toJSON()` for an object allows overriding its serialization behavior. Example: const obj = { data: "data", toJSON(key) { return key ? `Now I am a nested object under key '${key}'` : this; }, }; JSON.stringify(obj); /...
[ -1.000914216041565, -0.14128372073173523, -0.9304812550544739, -0.08832274377346039, -0.05468844249844551, -1.732774019241333, -0.06755765527486801, 0.4491877257823944, -0.21674270927906036, 0.2575153708457947, -0.13207383453845978, 0.04330490902066231, -0.616023600101471, -0.0494134761393...
javascript/reference/global_objects/json/stringify/index.md
JavaScript - Global Objects - JSON - stringify - Examples - Issue with serializing circular references: Since the JSON format doesn't support object references (although an IETF draft exists), a `TypeError` will be thrown if one attempts to encode an object with circular references. Example: const circularReference ...
[ -0.9612757563591003, 0.1294383853673935, -0.4265349209308624, 0.24877917766571045, 0.33541566133499146, -0.3710870146751404, 0.5265026092529297, 0.34982118010520935, -0.3234299123287201, -0.19332516193389893, 0.11618851125240326, -0.18522652983665466, 0.551906168460846, -0.4082407057285309...
javascript/reference/global_objects/json/stringify/index.md
JavaScript - Global Objects - JSON - stringify - Examples - Using JSON.stringify() with localStorage: In a case where you want to store an object created by your user and allow it to be restored even after the browser has been closed, the following example is a model for the applicability of `JSON.stringify()`: Examp...
[ -0.39379560947418213, 0.4704113304615021, -1.6666579246520996, -0.058291323482990265, -0.19911625981330872, -1.0731290578842163, 0.43574196100234985, 0.07466278970241547, 0.025049321353435516, 0.0823558121919632, 0.33543920516967773, 1.0771121978759766, -0.3970617353916168, 0.1704419851303...
javascript/reference/global_objects/json/stringify/index.md
JavaScript - Global Objects - JSON - stringify - Examples - Well-formed JSON.stringify(): Engines implementing the well-formed JSON.stringify specification will stringify lone surrogates (any code point from U+D800 to U+DFFF) using Unicode escape sequences rather than literally (outputting lone surrogates). Before thi...
[ -1.1710783243179321, 0.4799576997756958, -1.7552381753921509, -0.20623856782913208, 0.27293890714645386, -1.5004454851150513, 0.5664089322090149, 0.6030696034431458, -0.3897238075733185, 0.40542763471603394, -0.44357550144195557, -0.054356638342142105, -0.2772877812385559, 0.03972919657826...
javascript/reference/global_objects/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array: The `BigUint64Array` typed array represents an array of 64-bit unsigned integers in the platform byte order. If control over byte order is needed, use `DataView` instead. The contents are initialized to `0n` unless initialization data is explicitly provided. Once establish...
[ -0.36958178877830505, -0.5346800088882446, -1.09462308883667, 0.5372676849365234, 0.41780054569244385, -0.36095699667930603, 0.29186952114105225, 1.196502447128296, 0.05264598876237869, 0.45641762018203735, -0.45409926772117615, -0.02049228921532631, 0.35432684421539307, 0.0227201152592897...
javascript/reference/global_objects/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array - Constructor: - `BigUint64Array()`: Creates a new `BigUint64Array` object.
[ -0.44622525572776794, -0.2984723150730133, -1.121940016746521, 0.6117562651634216, -0.20604214072227478, -0.7280941605567932, -1.0153627395629883, 0.8620024919509888, 0.0948493629693985, 0.30444610118865967, -0.44669488072395325, -0.30890700221061707, 0.07768429070711136, 0.228005900979042...
javascript/reference/global_objects/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array - Static properties: Also inherits static properties from its parent `TypedArray`. - `BigUint64Array.BYTES_PER_ELEMENT`: Returns a number value of the element size. `8` in the case of `BigUint64Array`.
[ -0.6860148310661316, -0.019308723509311676, -1.1139692068099976, 0.03220725804567337, -0.1528598666191101, -1.365391492843628, 0.23133566975593567, 0.8267449140548706, -0.20875735580921173, 0.00810373853892088, -0.6216710805892944, 0.677294135093689, -0.5117073655128479, 0.0314814336597919...
javascript/reference/global_objects/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array - Static methods: Inherits static methods from its parent `TypedArray`.
[ -0.2557264268398285, 0.10409445315599442, -1.1744533777236938, 0.07759829610586166, -0.0795663520693779, -1.0940190553665161, 0.3081710636615753, 1.457850694656372, -0.4337078630924225, 0.06235406920313835, -0.771668016910553, -0.39442700147628784, -0.25787490606307983, 0.16265948116779327...
javascript/reference/global_objects/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array - Instance properties: Also inherits instance properties from its parent `TypedArray`. These properties are defined on `BigUint64Array.prototype` and shared by all `BigUint64Array` instances. - `BigUint64Array.prototype.BYTES_PER_ELEMENT`: Returns a number value of the el...
[ 0.06323280185461044, -0.2649978697299957, -0.9038515090942383, 0.05093523487448692, -0.013978599570691586, -1.0035037994384766, -0.40698209404945374, 0.7166696190834045, 0.34324193000793457, 0.09992386400699615, -0.840057909488678, 0.6305723190307617, -0.6477642059326172, 0.406488984823226...
javascript/reference/global_objects/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array - Instance methods: Inherits instance methods from its parent `TypedArray`.
[ 0.22106780111789703, -0.10289646685123444, -0.8483656048774719, 0.2770760655403137, -0.3573167324066162, -0.9273045063018799, 0.26414793729782104, 0.7770830988883972, -0.3521331250667572, -0.3188953101634979, -0.5803900957107544, -0.0931188091635704, -0.14506547152996063, 0.502523779869079...
javascript/reference/global_objects/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array - Examples - Different ways to create a BigUint64Array: Example: // From a length const biguint64 = new BigUint64Array(2); biguint64[0] = 42n; console.log(biguint64[0]); // 42n console.log(biguint64.length); // 2 console.log(biguint64.BYTES_PER_ELEMENT); // 8 // From an a...
[ -0.025096841156482697, -0.3635399639606476, -0.4817066490650177, 0.5978127121925354, 0.47965097427368164, -0.2872365713119507, 0.19338540732860565, 0.6871299147605896, -0.0027501366566866636, 0.03196517378091812, 0.05963298678398132, 0.12817978858947754, 0.1249733716249466, 0.0437644869089...
javascript/reference/global_objects/biguint64array/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array: The `BigUint64Array()` constructor creates `BigUint64Array` objects. The contents are initialized to `0n` unless initialization data is explicitly provided.
[ 0.03157724440097809, -0.03077908232808113, -0.6610758900642395, 0.8936644196510315, -0.15765316784381866, -0.7287908792495728, -0.6610721945762634, 0.6111324429512024, -0.29064610600471497, 0.4965522289276123, -0.50225830078125, -0.42506396770477295, -0.17502543330192566, -0.30195578932762...
javascript/reference/global_objects/biguint64array/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array - Syntax: Example: new BigUint64Array() new BigUint64Array(length) new BigUint64Array(typedArray) new BigUint64Array(object) new BigUint64Array(buffer) new BigUint64Array(buffer, byteOffset) new BigUint64Array(buffer, byteOffset, length) Note: `BigUint64Array()` can only...
[ -0.36314186453819275, 0.045200034976005554, -1.2414311170578003, 0.027828557416796684, 0.13473661243915558, -1.1827813386917114, -1.1570765972137451, 1.2036901712417603, 0.4256957173347473, 0.022579900920391083, -0.1648559272289276, 0.17875051498413086, 0.09737900644540787, 0.3198326230049...
javascript/reference/global_objects/biguint64array/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array - Syntax - Parameters: See `TypedArray`.
[ 0.4921889901161194, -0.0036174680572003126, -1.1215201616287231, 0.21819278597831726, -0.4066431522369385, -0.6817792057991028, -0.07527156174182892, 0.7865241765975952, 0.009685546159744263, 0.4052659571170807, -0.3695012331008911, -0.05045683681964874, 0.6020162105560303, 0.5289056301116...
javascript/reference/global_objects/biguint64array/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array - Syntax - Exceptions: See `TypedArray`.
[ 0.13303975760936737, -0.3652667999267578, -0.8244225978851318, 0.44193369150161743, -0.5276122093200684, -1.0777770280838013, -0.4543856978416443, 0.867648720741272, -0.18194404244422913, 0.14467200636863708, -0.07024051994085312, -0.32273319363594055, 0.25820979475975037, 0.56016635894775...
javascript/reference/global_objects/biguint64array/biguint64array/index.md
JavaScript - Global Objects - BigUint64Array - Examples - Different ways to create a BigUint64Array: Example: // From a length const biguint64 = new BigUint64Array(2); biguint64[0] = 42n; console.log(biguint64[0]); // 42n console.log(biguint64.length); // 2 console.log(biguint64.BYTES_PER_ELEMENT); // 8 // From an a...
[ -0.025096841156482697, -0.3635399639606476, -0.4817066490650177, 0.5978127121925354, 0.47965097427368164, -0.2872365713119507, 0.19338540732860565, 0.6871299147605896, -0.0027501366566866636, 0.03196517378091812, 0.05963298678398132, 0.12817978858947754, 0.1249733716249466, 0.0437644869089...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map: The `Map` object holds key-value pairs and remembers the original insertion order of the keys. Any value (both objects and `primitive values`) may be used as either a key or a value. Example: const map = new Map(); map.set("a", 1); map.set("b", 2); map.set("c", 3); console.log(ma...
[ -0.26654699444770813, -0.2290739268064499, -1.753151535987854, 0.38777515292167664, -0.20953227579593658, -1.75860595703125, 0.5810430645942688, 0.4699757397174835, 0.019529813900589943, -0.11088261008262634, -0.5366582870483398, 0.1313050538301468, 0.1724746823310852, 0.34349319338798523,...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Description: `Map` objects are collections of key-value pairs. A key in the `Map` may only occur once; it is unique in the `Map`'s collection. A `Map` object is iterated by key-value pairs — a `for...of` loop returns a 2-member array of `[key, value]` for each iteration. Iteration h...
[ -0.17131026089191437, -0.47259649634361267, -1.5375150442123413, 1.0955865383148193, 0.18811140954494476, -1.192678451538086, 0.36655744910240173, -0.0852615088224411, -0.8044456243515015, 0.2816396653652191, -0.2587376534938812, 0.06507768481969833, 0.6110712885856628, 0.4235166311264038,...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Description - Key equality: Value equality is based on the SameValueZero algorithm. (It used to use SameValue, which treated `0` and `-0` as different. Check browser compatibility.) This means `NaN` is considered the same as `NaN` (even though `NaN !== NaN`) and all other values are...
[ -0.4260047674179077, -0.27509087324142456, -0.7745944261550903, 0.39085739850997925, 0.008018214255571365, -1.194143533706665, 1.5685315132141113, 0.6818758845329285, -0.7323794960975647, 0.2805826663970947, -0.5666738152503967, -0.5633299946784973, 0.1791013777256012, 0.19452235102653503,...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Description - Objects vs. Maps: `Object` is similar to `Map`—both let you set keys to values, retrieve those values, delete keys, and detect whether something is stored at a key. For this reason (and because there were no built-in alternatives), `Object` has been used as `Map` histo...
[ -0.18588894605636597, -0.5570989847183228, -1.445325493812561, 0.490447998046875, 0.013436189852654934, -2.4673070907592773, 0.2558177411556244, 0.35535457730293274, 0.3539906442165375, 0.032856378704309464, -0.5616174936294556, -0.5244907140731812, 0.19177860021591187, -0.0565627776086330...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Description - Setting object properties: Setting Object properties works for Map objects as well, and can cause considerable confusion. Therefore, this appears to work in a way: Example: const wrongMap = new Map(); wrongMap["bla"] = "blaa"; wrongMap["bla2"] = "blaaa2"; console.l...
[ -0.39283281564712524, -0.17726054787635803, -0.8695266246795654, 0.8972221612930298, 0.045775629580020905, -0.957619845867157, 0.5003870129585266, 0.3193901479244232, 0.14812149107456207, 0.24140313267707825, -0.6218598484992981, 0.2601730227470398, 0.903095006942749, -0.12479282170534134,...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Description - Map-like browser APIs: Browser `Map`-like objects (or "maplike objects") are Web API interfaces that behave in many ways like a `Map`. Just like `Map`, entries can be iterated in the same order that they were added to the object. `Map`-like objects and `Map` also have...
[ -0.6178199648857117, 0.2335129976272583, -0.13089892268180847, 0.8958214521408081, 0.5171364545822144, -0.4907796382904053, 0.3777735233306885, 0.7149350047111511, -0.4873477518558502, 0.4378120005130768, -0.5602051019668579, 0.2893141806125641, 0.14123207330703735, 0.18287932872772217, ...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Constructor: - `Map()`: Creates a new `Map` object.
[ -0.9516386985778809, -0.45478788018226624, -1.0272012948989868, 0.1610736846923828, -0.348783940076828, -2.032071113586426, -0.04365507885813713, 0.5783448219299316, -0.24623171985149384, 0.011173811741173267, -0.4881772994995117, -0.3522316515445709, -0.0327615924179554, 0.163427218794822...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Static properties: - `Map[Symbol.species]`: The constructor function that is used to create derived objects.
[ -0.49487969279289246, 0.07834848761558533, -0.8785784244537354, 0.2964138984680176, -0.057665009051561356, -2.5250298976898193, 0.3500046133995056, 0.9252564311027527, 0.19864991307258606, 0.25906455516815186, -1.3107739686965942, 0.19075310230255127, -0.40836673974990845, 0.48206430673599...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Static methods: - `Map.groupBy()`: Groups the elements of a given iterable using the values returned by a provided callback function. The final returned `Map` uses the unique values from the test function as keys, which can be used to get the array of elements in each group.
[ -0.14201362431049347, 0.07229118049144745, -1.0383009910583496, 0.5740029215812683, -0.18493349850177765, -1.4196867942810059, 1.2717481851577759, -0.3954868018627167, -1.0254915952682495, 1.0237915515899658, -0.9299731254577637, -0.10022124648094177, 0.6696977615356445, 0.1378742605447769...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Instance properties: These properties are defined on `Map.prototype` and shared by all `Map` instances. - `Map.prototype.constructor`: The constructor function that created the instance object. For `Map` instances, the initial value is the `Map` constructor. - `Map.prototype.size`:...
[ -0.6538212895393372, -0.3339439034461975, -0.6969026327133179, 0.25781095027923584, -0.2086157202720642, -2.4066665172576904, 0.49056392908096313, 0.6854490637779236, 0.11369290202856064, -0.049063555896282196, -0.9446711540222168, 0.10061272978782654, -0.0792488157749176, 0.04614209756255...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Instance methods: - `Map.prototype.clear()`: Removes all key-value pairs from the `Map` object. - `Map.prototype.delete()`: Removes the entry specified by the key from this `Map`. - `Map.prototype.entries()`: Returns a new Iterator object that contains a two-member array of `[key, v...
[ -0.3680919110774994, -0.16913577914237976, -0.20775291323661804, 0.4541712999343872, 0.4480939209461212, -0.30200543999671936, 0.6928653717041016, 0.552396833896637, -0.260755717754364, 0.19632267951965332, -0.4341490566730499, -0.24225080013275146, 0.05729440972208977, 0.42414072155952454...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Examples - Using the Map object: Example: const myMap = new Map(); const keyString = "a string"; const keyObj = {}; const keyFunc = () => {}; // setting the values myMap.set(keyString, "value associated with 'a string'"); myMap.set(keyObj, "value associated with keyObj"); myMap.s...
[ 0.07210326194763184, 0.27324917912483215, -1.0173717737197876, 0.23219554126262665, 0.0028581630904227495, -0.7149786949157715, 0.37704533338546753, -0.1877865195274353, -0.07945036143064499, 0.3373429477214813, 0.09759698808193207, -0.14552006125450134, -0.11792416125535965, 0.50468021631...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Examples - Using NaN as Map keys: `NaN` can also be used as a key. Even though every `NaN` is not equal to itself (`NaN !== NaN` is true), the following example works because `NaN`s are indistinguishable from each other: Example: const myMap = new Map(); myMap.set(NaN, "not a numb...
[ -0.10884708911180496, 0.07179425656795502, -1.024132251739502, -0.0020979526452720165, -0.8382734060287476, -1.6709970235824585, 0.8406039476394653, 0.3092502951622009, -0.6066099405288696, 0.5825468301773071, -0.4798315465450287, 0.1432870626449585, -0.5231335759162903, -0.455765277147293...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Examples - Iterating Map with for...of: Maps can be iterated using a `for...of` loop: Example: const myMap = new Map(); myMap.set(0, "zero"); myMap.set(1, "one"); for (const [key, value] of myMap) { console.log(`${key} = ${value}`); } // 0 = zero // 1 = one for (const key of m...
[ -0.694862961769104, 0.22067891061306, 0.0715906023979187, 0.5327368974685669, 0.8230476379394531, -0.9769465923309326, 1.0856810808181763, 0.45690852403640747, -0.03508613631129265, -0.011100592091679573, 0.04070286825299263, -0.07508470863103867, 0.08677943050861359, 0.3318008482456207, ...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Examples - Iterating Map with forEach(): Maps can be iterated using the `forEach()` method: Example: myMap.forEach((value, key) => { console.log(`${key} = ${value}`); }); // 0 = zero // 1 = one
[ -0.15141567587852478, -0.03571280092000961, 0.1056632548570633, 0.2888104319572449, 0.24992592632770538, -2.2891359329223633, 0.7358652353286743, 1.0273866653442383, -1.0655871629714966, 0.12326506525278091, -0.13733719289302826, 0.2198118269443512, -0.018934505060315132, -0.00845523364841...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Examples - Relation with Array objects: Example: const kvArray = [ ["key1", "value1"], ["key2", "value2"], ]; // Use the regular Map constructor to transform a 2D key-value Array into a map const myMap = new Map(kvArray); console.log(myMap.get("key1")); // "value1" // Use Ar...
[ 0.0010908436961472034, 0.21267825365066528, -1.059298038482666, 0.44934213161468506, -0.5954253673553467, -1.2099368572235107, -0.4050969183444977, 0.42401933670043945, 0.15505731105804443, 0.508210301399231, 0.3310484290122986, 0.2972855269908905, -0.19790229201316833, 0.21802428364753723...
javascript/reference/global_objects/map/index.md
JavaScript - Global Objects - Map - Examples - Cloning and merging Maps: Just like `Array`s, `Map`s can be cloned: Example: const original = new Map([[1, "one"]]); const clone = new Map(original); console.log(clone.get(1)); // one console.log(original === clone); // false (useful for shallow comparison) Note: Kee...
[ -0.18760798871517181, 0.13459104299545288, -1.3397912979125977, 0.03962988033890724, -0.10544557124376297, -1.6724201440811157, 0.6422168016433716, 0.15978318452835083, 0.1403762251138687, 0.23193804919719696, -0.4626004099845886, 0.18761351704597473, -0.30500486493110657, -0.0289947651326...
javascript/reference/global_objects/map/symbol.species/index.md
JavaScript - Global Objects - Map - Symbol.species: The `Map[Symbol.species]` static accessor property is an unused accessor property specifying how to copy `Map` objects.
[ -1.372658610343933, -0.2298748940229416, -1.4054902791976929, 0.19921095669269562, -0.6423122882843018, -2.4376533031463623, 0.9521169662475586, 0.7082225680351257, 0.33250969648361206, 0.13261723518371582, -0.998931348323822, -0.17349174618721008, 0.009229704737663269, 0.18477314710617065...
javascript/reference/global_objects/map/symbol.species/index.md
JavaScript - Global Objects - Map - Symbol.species - Syntax: Example: Map[Symbol.species]
[ -0.4430942237377167, -0.08200369030237198, -0.9911791086196899, -0.4686061441898346, -1.0044926404953003, -2.7699525356292725, 0.18283800780773163, 0.9682886600494385, 0.026419155299663544, -0.36260882019996643, -0.25411421060562134, 0.8543774485588074, -0.06014745682477951, 0.322555214166...
javascript/reference/global_objects/map/symbol.species/index.md
JavaScript - Global Objects - Map - Symbol.species - Syntax - Return value: The value of the constructor (`this`) on which `get [Symbol.species]` was called. The return value is used to construct copied `Map` instances.
[ -0.8914319276809692, 0.31222277879714966, -0.7876505255699158, 0.40534764528274536, -0.8068260550498962, -2.174168825149536, 0.5361735820770264, 1.0541008710861206, -0.23194263875484467, 0.14815229177474976, -0.6412286162376404, 1.1372252702713013, -0.23563659191131592, 1.0772486925125122,...
javascript/reference/global_objects/map/symbol.species/index.md
JavaScript - Global Objects - Map - Symbol.species - Description: The `[Symbol.species]` accessor property returns the default constructor for `Map` objects. Subclass constructors may override it to change the constructor assignment. Note: This property is currently unused by all `Map` methods.
[ -1.673642873764038, -0.6764463186264038, -1.2230440378189087, 0.48240765929222107, -0.7175632119178772, -2.375279664993286, 0.535279393196106, 0.38594284653663635, -0.04554236680269241, -0.2627953886985779, -0.424836665391922, 0.6437593102455139, -0.02356799505650997, 0.2978091835975647, ...
javascript/reference/global_objects/map/symbol.species/index.md
JavaScript - Global Objects - Map - Symbol.species - Examples - Species in ordinary objects: The `[Symbol.species]` property returns the default constructor function, which is the `Map` constructor for `Map`. Example: Map[Symbol.species]; // function Map()
[ -1.2427246570587158, 0.141847163438797, -1.4752148389816284, -0.040032073855400085, -0.47825029492378235, -2.4089980125427246, -0.09840165823698044, 0.5285767316818237, -0.44242236018180847, -0.15778568387031555, -0.5067362785339355, 0.7515767812728882, 0.020950904116034508, 0.081315502524...
javascript/reference/global_objects/map/symbol.species/index.md
JavaScript - Global Objects - Map - Symbol.species - Examples - Species in derived objects: In an instance of a custom `Map` subclass, such as `MyMap`, the `MyMap` species is the `MyMap` constructor. However, you might want to overwrite this, in order to return parent `Map` objects in your derived class methods: Exam...
[ -1.729925513267517, -0.6115361452102661, -0.7340198755264282, 0.3760271966457367, -0.2787923216819763, -2.615882158279419, 0.3194811940193176, 0.03950769081711769, -0.5620142221450806, -0.11152656376361847, -0.6565901637077332, 0.865537166595459, -1.2313172817230225, 0.16567189991474152, ...
javascript/reference/global_objects/map/set/index.md
JavaScript - Global Objects - Map - set: The `set()` method of `Map` instances adds a new entry with a specified key and value to this `Map`, or updates an existing entry if the key already exists. Example: const map = new Map(); map.set("bar", "foo"); console.log(map.get("bar")); // Expected output: "foo" console...
[ -0.4033387303352356, -0.7153424620628357, -1.6423015594482422, 1.0847991704940796, -0.023154592141509056, -2.037672758102417, 0.6064103841781616, 0.5723763108253479, -0.054590653628110886, 0.01776070147752762, -0.4343348741531372, 0.17633992433547974, 0.2677742838859558, 0.5388296246528625...
javascript/reference/global_objects/map/set/index.md
JavaScript - Global Objects - Map - set - Syntax: Example: set(key, value)
[ -0.21423909068107605, -0.006980889942497015, -1.5390723943710327, 0.10367792099714279, -0.7492303848266602, -1.9323207139968872, 0.4411952495574951, 0.8690621256828308, -0.08901522308588028, -0.6925288438796997, 0.2504180669784546, 0.5780121684074402, 0.29309725761413574, 0.335042208433151...
javascript/reference/global_objects/map/set/index.md
JavaScript - Global Objects - Map - set - Syntax - Parameters: - `key`: The key of the entry to add to or modify within the `Map` object. Can be any value. Object keys are compared by reference, not by value. - `value`: The value of the entry to add to or modify within the `Map` object. Can be any value.
[ 0.029238121584057808, -0.3194636404514313, -1.3506571054458618, 0.2665165960788727, -0.2028670310974121, -2.1212589740753174, 0.49146580696105957, 0.5709627270698547, 0.23524636030197144, -0.7394449710845947, -0.23653732240200043, 0.2728077471256256, -0.32508283853530884, 0.381918877363204...
javascript/reference/global_objects/map/set/index.md
JavaScript - Global Objects - Map - set - Syntax - Return value: The `Map` object.
[ -0.2963487207889557, -0.1921110451221466, -1.512980580329895, -0.26758554577827454, -0.4963996708393097, -1.8589402437210083, 0.5657262206077576, 0.8991890549659729, -0.16494785249233246, -0.3385281264781952, -0.1716000884771347, 0.7309091091156006, 0.2444818913936615, 0.5102823376655579, ...
javascript/reference/global_objects/map/set/index.md
JavaScript - Global Objects - Map - set - Examples - Using set(): Example: const myMap = new Map(); // Add new elements to the map myMap.set("bar", "foo"); myMap.set(1, "foobar"); // Update an element in the map myMap.set("bar", "baz");
[ -0.10608108341693878, -0.3862582743167877, -1.533460021018982, 0.9800076484680176, -0.32165762782096863, -1.9828951358795166, 0.4061339199542999, 0.5307525396347046, -0.05888950824737549, -0.09511499851942062, -0.9491873979568481, 0.3738396167755127, -0.049474623054265976, -0.0700317844748...
javascript/reference/global_objects/map/set/index.md
JavaScript - Global Objects - Map - set - Examples - Using the set() with chaining: Since the `set()` method returns back the same `Map` object, you can chain the method call like below: Example: // Add new elements to the map with chaining. myMap.set("bar", "foo").set(1, "foobar").set(2, "baz");
[ -0.6820906400680542, -0.24683982133865356, -1.7289726734161377, 0.7820269465446472, -0.6100192666053772, -1.9401342868804932, 0.3171793222427368, 1.2624585628509521, -1.6865867376327515, 0.23353786766529083, -0.686276912689209, 0.6523407101631165, 0.6772024631500244, 0.03041350096464157, ...
javascript/reference/global_objects/map/size/index.md
JavaScript - Global Objects - Map - size: The `size` accessor property of `Map` instances returns the number of elements in this map. Example: const map = new Map(); map.set("a", "alpha"); map.set("b", "beta"); map.set("g", "gamma"); console.log(map.size); // Expected output: 3
[ -0.34375226497650146, -0.8034225702285767, -1.724346399307251, 0.0607496052980423, -0.7501463294029236, -1.1805115938186646, 0.22590379416942596, 0.05890405923128128, 0.26963862776756287, 0.030529862269759178, -0.7975607514381409, 0.884774386882782, 0.1996852606534958, 0.32078036665916443,...
javascript/reference/global_objects/map/size/index.md
JavaScript - Global Objects - Map - size - Description: The value of `size` is an integer representing how many entries the `Map` object has. A set accessor function for `size` is `undefined`; you can not change this property.
[ -0.8367824554443359, -0.8549654483795166, -1.6027324199676514, -0.23966875672340393, -0.8038535118103027, -1.5102397203445435, 0.9528499841690063, 0.07088141143321991, 0.06008894741535187, -0.5109485387802124, -0.6448478102684021, 0.09963420033454895, 0.28930050134658813, -0.16548334062099...
javascript/reference/global_objects/map/size/index.md
JavaScript - Global Objects - Map - size - Examples - Using size: Example: const myMap = new Map(); myMap.set("a", "alpha"); myMap.set("b", "beta"); myMap.set("g", "gamma"); console.log(myMap.size); // 3
[ -0.5328280925750732, -0.42135652899742126, -1.2422428131103516, -0.14175225794315338, -0.6533334851264954, -1.6707746982574463, 0.04666836932301521, 0.21204420924186707, 0.5625255703926086, -0.15340495109558105, -0.5239149928092957, 1.0037286281585693, -0.07248791307210922, -0.543104231357...
javascript/reference/global_objects/map/getorinsert/index.md
JavaScript - Global Objects - Map - getOrInsert: The `getOrInsert()` method of `Map` instances returns the value corresponding to the specified key in this `Map`. If the key is not present, it inserts a new entry with the key and a given default value, and returns the inserted value. If the computation of the default...
[ -0.36174511909484863, -0.14254449307918549, -1.05596923828125, 0.46831274032592773, -0.09656519442796707, -1.314670205116272, 0.5362647771835327, 0.11809557676315308, 0.05207452550530434, 0.48848578333854675, -0.11355520784854889, 0.358707070350647, 0.2755974233150482, 0.2649719715118408, ...
javascript/reference/global_objects/map/getorinsert/index.md
JavaScript - Global Objects - Map - getOrInsert - Syntax: Example: getOrInsert(key, defaultValue)
[ -0.2103668600320816, 0.06339322030544281, -0.9190227389335632, 0.20787625014781952, -0.7530912756919861, -1.6815565824508667, 0.49382585287094116, 0.7973013520240784, -0.19319774210453033, -0.5035510063171387, -0.05479707568883896, 0.06685949116945267, -0.16986075043678284, -0.181713491678...
javascript/reference/global_objects/map/getorinsert/index.md
JavaScript - Global Objects - Map - getOrInsert - Syntax - Parameters: - `key`: The key of the value to return from the `Map` object. Object keys are compared by reference, not by value. - `defaultValue`: The value to insert and return if the key is not already present in the `Map` object.
[ -0.26832330226898193, -0.10839410126209259, -1.143676996231079, 0.018895132467150688, -0.3037831783294678, -1.6997216939926147, 0.8986611366271973, 0.4571020305156708, -0.06408829987049103, -0.0850006639957428, -0.16056925058364868, 0.48719045519828796, -0.34748056530952454, 0.584803700447...
javascript/reference/global_objects/map/getorinsert/index.md
JavaScript - Global Objects - Map - getOrInsert - Syntax - Return value: The value associated with the specified key in the `Map` object. If the key can't be found, `defaultValue` is inserted and returned.
[ -0.38642969727516174, -0.0453159399330616, -0.9893208146095276, 0.20417562127113342, -0.7808917164802551, -1.2486224174499512, 0.9479733109474182, 0.789526104927063, -0.07418341189622879, -0.030744871124625206, 0.20939241349697113, 0.7923507690429688, -0.06698578596115112, 0.89804160594940...
javascript/reference/global_objects/map/getorinsert/index.md
JavaScript - Global Objects - Map - getOrInsert - Description: The `getOrInsert()` method is equivalent to the following: Example: if (map.has(key)) { return map.get(key); } map.set(key, defaultValue); return defaultValue; It is also similar to the following pattern (which is slightly less reliable if `null` or `...
[ -0.7984519600868225, -0.24517181515693665, -1.3970869779586792, 0.5139895677566528, -0.41898903250694275, -1.804704189300537, 0.766488790512085, 0.7426443099975586, -0.15039026737213135, 0.23145757615566254, -0.05792327970266342, 0.1206749826669693, -0.02160847745835781, -0.123549327254295...
javascript/reference/global_objects/map/getorinsert/index.md
JavaScript - Global Objects - Map - getOrInsert - Examples - Multimap: In a map where each key is mapped to an array of values, you can use `getOrInsert()` to ensure that the array exists for a given key before attempting to push a new value to the array. Example: map.getOrInsert(key, []).push(value);
[ -0.5112525224685669, -0.10777262598276138, -0.9483085870742798, 0.5580316781997681, -0.4555349349975586, -1.1650331020355225, 0.7027506232261658, 0.8783953189849854, 0.10490365326404572, -0.3566530644893646, 0.3260139524936676, 0.3103194534778595, -0.1555413007736206, -0.14079399406909943,...
javascript/reference/global_objects/map/getorinsert/index.md
JavaScript - Global Objects - Map - getOrInsert - Examples - Applying default values: You can use `getOrInsert()` to ensure that a key exists in a map, even if you currently don't need its value. This is usually to normalize user input. Imagine you have a map of user preferences, and you want to ensure that a certain...
[ -0.10943830758333206, 0.25750088691711426, -0.8516468405723572, 0.8728564977645874, 0.2051629275083542, -1.2537366151809692, 0.5460329651832581, 0.45356839895248413, -0.15745338797569275, -0.21107110381126404, -0.07928337901830673, -0.06805906444787979, 0.040102824568748474, -0.09563992172...
javascript/reference/global_objects/map/has/index.md
JavaScript - Global Objects - Map - has: The `has()` method of `Map` instances returns a boolean indicating whether an entry with the specified key exists in this `Map` or not. Example: const map = new Map(); map.set("bar", "foo"); console.log(map.has("bar")); // Expected output: true console.log(map.has("baz")); ...
[ -0.11753057688474655, -1.1117080450057983, -1.2663320302963257, 0.8242735266685486, -0.17201970517635345, -2.091909885406494, 0.9030572772026062, 0.06796180456876755, -0.5414583683013916, 0.39343634247779846, -0.5684530138969421, 0.058500949293375015, 1.040205478668213, -0.045787513256073,...
javascript/reference/global_objects/map/has/index.md
JavaScript - Global Objects - Map - has - Syntax: Example: has(key)
[ 0.45703548192977905, 0.2109915018081665, -1.3497408628463745, -0.10266973078250885, -0.8543698787689209, -2.043765068054199, 0.6298474669456482, 0.54593425989151, -0.9165847301483154, -0.06097899004817009, -0.28579413890838623, 0.30112525820732117, 0.1294095516204834, 0.2723051607608795, ...
javascript/reference/global_objects/map/has/index.md
JavaScript - Global Objects - Map - has - Syntax - Parameters: - `key`: The key of the entry to test for presence in the `Map` object. Object keys are compared by reference, not by value.
[ 0.0011089957552030683, -0.5754393935203552, -1.2063411474227905, -0.26223644614219666, -0.17269715666770935, -1.94905686378479, 0.8623287677764893, 0.33061426877975464, -0.16225700080394745, -0.1789114773273468, -0.7180563807487488, 0.12776079773902893, -0.12552307546138763, 0.533337950706...
javascript/reference/global_objects/map/has/index.md
JavaScript - Global Objects - Map - has - Syntax - Return value: Returns `true` if an entry with the specified key exists in the `Map` object; otherwise `false`.
[ -0.4506049156188965, -0.4168257415294647, -0.9090786576271057, 0.4094246029853821, -0.7025380730628967, -1.8466377258300781, 1.1214985847473145, 0.32808127999305725, -0.8585115075111389, 0.20629584789276123, -0.4001062214374542, 0.15600505471229553, 0.5364071726799011, 0.5955970883369446, ...
javascript/reference/global_objects/map/has/index.md
JavaScript - Global Objects - Map - has - Examples - Using has(): Example: const myMap = new Map(); myMap.set("bar", "foo"); console.log(myMap.has("bar")); // true console.log(myMap.has("baz")); // false
[ 0.040736183524131775, -0.5944437384605408, -1.1101964712142944, 0.7546946406364441, -0.42638900876045227, -1.8606680631637573, 0.32216301560401917, 0.038153041154146194, -0.27183863520622253, 0.1989348828792572, -0.8124945163726807, 0.020297322422266006, 0.24419835209846497, -0.13717541098...
javascript/reference/global_objects/map/keys/index.md
JavaScript - Global Objects - Map - keys: The `keys()` method of `Map` instances returns a new map iterator object that contains the keys for each element in this map in insertion order. Example: const map = new Map(); map.set("0", "foo"); map.set(1, "bar"); const iterator = map.keys(); console.log(iterator.next(...
[ 0.17529989778995514, -0.7487836480140686, -1.581217646598816, 0.5945226550102234, 0.14220717549324036, -1.3565101623535156, 0.08172335475683212, 0.34885355830192566, -0.7544510364532471, 0.8155646920204163, -0.058499522507190704, 0.5276410579681396, 0.678549587726593, 0.7922767400741577, ...
javascript/reference/global_objects/map/keys/index.md
JavaScript - Global Objects - Map - keys - Syntax: Example: keys()
[ 0.2837090492248535, -0.09387800097465515, -1.5343459844589233, -0.012170462869107723, -0.7324604392051697, -2.0758659839630127, 1.0431842803955078, 0.9444056153297424, -0.5623825788497925, -0.3890417814254761, -0.00045075942762196064, 0.536589503288269, -0.12095896899700165, 0.421170115470...
javascript/reference/global_objects/map/keys/index.md
JavaScript - Global Objects - Map - keys - Syntax - Parameters: None.
[ 0.17796047031879425, 0.3830243647098541, -1.5383127927780151, -0.5898234844207764, -0.4990870952606201, -1.5038305521011353, 1.1321730613708496, 1.114359974861145, -0.5747690200805664, -0.5227722525596619, -0.4825858473777771, -0.39879557490348816, 0.05035704746842384, 0.3683006167411804, ...
javascript/reference/global_objects/map/keys/index.md
JavaScript - Global Objects - Map - keys - Syntax - Return value: A new iterable iterator object.
[ -0.08085367828607559, 0.03909319266676903, -1.0233830213546753, -0.1177094504237175, -0.46340513229370117, -1.6852954626083374, 0.11400359869003296, 1.306593894958496, -0.4322696626186371, 0.3463805615901947, -0.3518545627593994, 0.32859644293785095, -0.18614715337753296, 1.176033973693847...
javascript/reference/global_objects/map/keys/index.md
JavaScript - Global Objects - Map - keys - Examples - Using keys(): Example: const myMap = new Map(); myMap.set("0", "foo"); myMap.set(1, "bar"); myMap.set({}, "baz"); const mapIter = myMap.keys(); console.log(mapIter.next().value); // "0" console.log(mapIter.next().value); // 1 console.log(mapIter.next().value); /...
[ 0.3075549900531769, 0.3196965754032135, -0.6343439221382141, 0.2761435806751251, -0.38692134618759155, -1.0701271295547485, -0.11873607337474823, 0.4612268805503845, 0.10216736793518066, -0.30994847416877747, -0.3416420519351959, -0.42569613456726074, 0.17689713835716248, 0.325818806886673...
javascript/reference/global_objects/map/symbol.iterator/index.md
JavaScript - Global Objects - Map - Symbol.iterator: The `[Symbol.iterator]()` method of `Map` instances implements the iterable protocol and allows `Map` objects to be consumed by most syntaxes expecting iterables, such as the spread syntax and `for...of` loops. It returns a map iterator object that yields the key-va...
[ 0.06862708926200867, -0.06313297152519226, -0.9776545166969299, 0.6851769685745239, 0.3838208317756653, -1.685495138168335, -0.37963467836380005, 0.72772616147995, -0.45441362261772156, 0.5876065492630005, -0.5839495658874512, 0.6345138549804688, 0.034971512854099274, 0.3645215332508087, ...
javascript/reference/global_objects/map/symbol.iterator/index.md
JavaScript - Global Objects - Map - Symbol.iterator - Syntax: Example: map[Symbol.iterator]()
[ -0.06994955986738205, 0.14010947942733765, -0.49390527606010437, -0.38490378856658936, -0.2637258470058441, -2.4491984844207764, -0.364930659532547, 1.0144108533859253, 0.03969218581914902, -0.27247124910354614, 0.07111379504203796, 1.0194064378738403, -0.12756900489330292, 0.1458931118249...
javascript/reference/global_objects/map/symbol.iterator/index.md
JavaScript - Global Objects - Map - Symbol.iterator - Syntax - Parameters: None.
[ -0.0477188415825367, 0.29155397415161133, -0.7709474563598633, -0.5294725298881531, -0.17559954524040222, -1.9782899618148804, -0.08067288994789124, 1.4178277254104614, -0.4258151650428772, -0.46167415380477905, -0.426882266998291, 0.20168575644493103, -0.05458560213446617, 0.3414837718009...
javascript/reference/global_objects/map/symbol.iterator/index.md
JavaScript - Global Objects - Map - Symbol.iterator - Syntax - Return value: The same return value as `Map.prototype.entries()`: a new iterable iterator object that yields the key-value pairs of the map.
[ -0.45787814259529114, -0.20383848249912262, -0.8426417708396912, 0.34852761030197144, -0.3612902760505676, -1.460542917251587, 0.22282731533050537, 1.3655402660369873, -0.697995662689209, 0.4616462290287018, -0.3112337291240692, 0.7926488518714905, 0.2280043363571167, 0.7987997531890869, ...
javascript/reference/global_objects/map/symbol.iterator/index.md
JavaScript - Global Objects - Map - Symbol.iterator - Examples - Iteration using for...of loop: Note that you seldom need to call this method directly. The existence of the `[Symbol.iterator]()` method makes `Map` objects iterable, and iterating syntaxes like the `for...of` loop automatically call this method to obtai...
[ -0.08502712845802307, 0.03597605228424072, -0.3634297251701355, 0.8376535177230835, 0.4017028510570526, -2.4192562103271484, -0.2639956772327423, 0.3848847448825836, -0.735867440700531, 0.40970486402511597, -0.4648985266685486, 0.22023718059062958, -0.31568992137908936, 0.6312714219093323,...
javascript/reference/global_objects/map/symbol.iterator/index.md
JavaScript - Global Objects - Map - Symbol.iterator - Examples - Manually hand-rolling the iterator: You may still manually call the `next()` method of the returned iterator object to achieve maximum control over the iteration process. Example: const myMap = new Map(); myMap.set("0", "foo"); myMap.set(1, "bar"); myM...
[ -0.1654650717973709, -0.17566409707069397, -0.779850959777832, 0.48290932178497314, 0.002579306485131383, -1.7309693098068237, -0.2712303102016449, 0.48892247676849365, -0.6549789905548096, 0.9123431444168091, -0.5850681662559509, 0.6316130757331848, -0.058842167258262634, 0.24408629536628...
javascript/reference/global_objects/map/map/index.md
JavaScript - Global Objects - Map: The `Map()` constructor creates `Map` objects.
[ -0.6010392308235168, -0.28373295068740845, -0.966008722782135, 0.37952107191085815, -0.4679161012172699, -2.1450016498565674, -0.05633380636572838, 0.30804622173309326, -0.2764434814453125, 0.11027561873197556, -0.4029294550418854, -0.2676846385002136, -0.13728299736976624, -0.095441244542...
javascript/reference/global_objects/map/map/index.md
JavaScript - Global Objects - Map - Syntax: Example: new Map() new Map(iterable) Note: `Map()` can only be constructed with `new`. Attempting to call it without `new` throws a `TypeError`.
[ -0.15921162068843842, 0.09535856544971466, -0.20099614560604095, 0.46831879019737244, -0.044455043971538544, -1.7122573852539062, -0.43768543004989624, 1.1339900493621826, -0.3068310618400574, -0.1470315009355545, -0.12223555892705917, 0.00029882878880016506, 0.5084333419799805, 0.04137878...
javascript/reference/global_objects/map/map/index.md
JavaScript - Global Objects - Map - Syntax - Parameters: - `iterable` (optional): If an iterable object (such as an array) is passed, all of its elements will be added to the new `Map`. Each element must be an object with two properties: `0` and `1`, which correspond to the key and value (for example, `[[1, "one"],[2,...
[ -0.40162745118141174, 0.15146277844905853, -0.6244429349899292, 0.5934745073318481, 0.21243344247341156, -1.856374979019165, 0.868928849697113, 0.4962363541126251, -0.7054498791694641, -0.03067210130393505, -0.4375402331352234, -0.35636141896247864, 0.3379899263381958, 0.41787418723106384,...
javascript/reference/global_objects/map/map/index.md
JavaScript - Global Objects - Map - Examples - Creating a new Map: Example: const myMap = new Map([ [1, "one"], [2, "two"], [3, "three"], ]);
[ -0.3216562569141388, -0.3685883581638336, -0.7485885620117188, 0.269891619682312, -0.12650339305400848, -1.8417798280715942, -0.33482825756073, 0.5526090860366821, 0.17983362078666687, -0.08055160194635391, -0.47865453362464905, -0.06890512257814407, 0.21367651224136353, -0.501678526401519...
javascript/reference/global_objects/map/clear/index.md
JavaScript - Global Objects - Map - clear: The `clear()` method of `Map` instances removes all elements from this map. Example: const map = new Map(); map.set("bar", "baz"); map.set(1, "foo"); console.log(map.size); // Expected output: 2 map.clear(); console.log(map.size); // Expected output: 0
[ 0.3346695601940155, -0.6746158003807068, -1.5927492380142212, -0.1191326156258583, 0.10935018211603165, -2.149168014526367, 0.5357765555381775, 0.0676686093211174, -0.1848635971546173, 0.3588748574256897, -0.41455379128456116, 0.14768150448799133, 0.5019466876983643, 0.19580581784248352, ...
javascript/reference/global_objects/map/clear/index.md
JavaScript - Global Objects - Map - clear - Syntax: Example: clear()
[ 0.0582071878015995, 0.12843087315559387, -1.063133955001831, -0.7619397640228271, -0.34080833196640015, -2.0050840377807617, 0.6232292652130127, 0.9207688570022583, -0.2642914354801178, -0.3304990828037262, 0.24486304819583893, 0.4602557122707367, 0.1356259137392044, 0.1281232088804245, ...
javascript/reference/global_objects/map/clear/index.md
JavaScript - Global Objects - Map - clear - Syntax - Parameters: None.
[ -0.07267078757286072, 0.1337328851222992, -1.3015607595443726, -0.9040878415107727, -0.3831000328063965, -1.7862271070480347, 1.0774401426315308, 0.9175193905830383, -0.2577604651451111, -0.40305858850479126, -0.3336946666240692, -0.20680727064609528, 0.2836659550666809, 0.2521315515041351...
javascript/reference/global_objects/map/clear/index.md
JavaScript - Global Objects - Map - clear - Syntax - Return value: None (`undefined`).
[ -0.5095778107643127, 0.3576045036315918, -1.1264575719833374, -1.047200083732605, -0.5555736422538757, -1.5246503353118896, 1.0371164083480835, 0.8731416463851929, -0.6758299469947815, 0.19070889055728912, 0.19998881220817566, 0.21557725965976715, 0.3433828353881836, 0.26148125529289246, ...
javascript/reference/global_objects/map/clear/index.md
JavaScript - Global Objects - Map - clear - Examples - Using clear(): Example: const myMap = new Map(); myMap.set("bar", "baz"); myMap.set(1, "foo"); console.log(myMap.size); // 2 console.log(myMap.has("bar")); // true myMap.clear(); console.log(myMap.size); // 0 console.log(myMap.has("bar")); // false
[ -0.27755996584892273, -0.35815560817718506, -1.0851125717163086, -0.06228692829608917, -0.07156515121459961, -1.841140866279602, 0.005484956782311201, 0.12079998105764389, 0.21313993632793427, 0.09458441287279129, -0.18318618834018707, 0.2887321710586548, 0.2284391075372696, -0.09289950877...
javascript/reference/global_objects/map/groupby/index.md
JavaScript - Global Objects - Map - groupBy: Note: In some versions of some browsers, this method was implemented as the method `Array.prototype.groupToMap()`. Due to web compatibility issues, it is now implemented as a static method. Check the browser compatibility table for details. The `Map.groupBy()` static metho...
[ -0.039865825325250626, 0.045578788965940475, -1.1934759616851807, 0.9344847202301025, -0.062154654413461685, -1.8242301940917969, 0.9189976453781128, -0.46654874086380005, -1.0563029050827026, 1.2639256715774536, -0.9430060982704163, 0.5711777806282043, -0.08410271257162094, 0.453324705362...
javascript/reference/global_objects/map/groupby/index.md
JavaScript - Global Objects - Map - groupBy - Syntax: Example: Map.groupBy(items, callbackFn)
[ 0.03358449414372444, 0.3939468562602997, -0.8698927760124207, 0.29589882493019104, -0.8381757140159607, -1.933571219444275, 0.6324267983436584, -0.4780362844467163, -1.2688848972320557, 0.3383311331272125, -0.7513021230697632, 0.42516201734542847, -0.09178526699542999, 0.5387829542160034, ...
javascript/reference/global_objects/map/groupby/index.md
JavaScript - Global Objects - Map - groupBy - Syntax - Parameters: - `items`: An iterable (such as an `Array`) whose elements will be grouped. - `callbackFn`: A function to execute for each element in the iterable. It should return a value (`object` or `primitive`) indicating the group of the current element. The func...
[ -0.18350569903850555, 0.2141832560300827, -0.9027745723724365, 0.3581535816192627, -0.28443944454193115, -1.9633336067199707, 0.5574170351028442, -0.39678484201431274, -1.086439609527588, 0.7645654082298279, -1.302167534828186, 0.29648351669311523, -0.6837896108627319, 1.1172375679016113, ...
javascript/reference/global_objects/map/groupby/index.md
JavaScript - Global Objects - Map - groupBy - Syntax - Return value: A `Map` object with keys for each group, each assigned to an array containing the elements of the associated group.
[ 0.2741249203681946, -0.05749638378620148, -1.138311743736267, 0.2680808901786804, -0.7951728701591492, -1.9272252321243286, 1.264107346534729, 0.018066618591547012, -0.8726271390914917, 0.24360166490077972, -0.3321971893310547, 0.7482817769050598, -0.020103100687265396, 0.9368854761123657,...
javascript/reference/global_objects/map/groupby/index.md
JavaScript - Global Objects - Map - groupBy - Description: `Map.groupBy()` calls a provided `callbackFn` function once for each element in an iterable. The callback function should return a value indicating the group of the associated element. The values returned by `callbackFn` are used as keys for the `Map` returned...
[ -0.6030173897743225, 0.46027323603630066, -1.3425670862197876, 0.31180885434150696, -0.15193219482898712, -1.9019595384597778, 1.0901049375534058, -1.264614224433899, -1.5051137208938599, 0.96538907289505, -0.5590092539787292, 0.4338526725769043, -0.34005624055862427, 0.9179737567901611, ...
javascript/reference/global_objects/map/groupby/index.md
JavaScript - Global Objects - Map - groupBy - Examples - Using Map.groupBy(): First we define an array containing objects representing an inventory of different foodstuffs. Each food has a `type` and a `quantity`. Example: const inventory = [ { name: "asparagus", type: "vegetables", quantity: 9 }, { name: "banan...
[ 0.21417534351348877, -0.008299585431814194, -0.6374713182449341, 0.8454371690750122, 0.36279118061065674, -1.1755045652389526, 0.15077045559883118, 0.48289361596107483, -0.6144273281097412, 0.08002141118049622, -0.45003417134284973, -0.20091389119625092, -0.5093503594398499, 0.548393309116...
javascript/reference/global_objects/map/getorinsertcomputed/index.md
JavaScript - Global Objects - Map - getOrInsertComputed: The `getOrInsertComputed()` method of `Map` instances returns the value corresponding to the specified key in this `Map`. If the key is not present, it inserts a new entry with the key and a default value computed from a given callback, and returns the inserted ...
[ -0.2382088154554367, 0.12202958762645721, -1.122996211051941, 0.5942442417144775, -0.04031851887702942, -1.4382967948913574, 0.4580528140068054, 0.20704269409179688, -0.1242184266448021, 0.8834627866744995, -0.07598619908094406, 0.44284576177597046, 0.20490896701812744, 0.28190767765045166...
javascript/reference/global_objects/map/getorinsertcomputed/index.md
JavaScript - Global Objects - Map - getOrInsertComputed - Syntax: Example: getOrInsertComputed(key, callback)
[ -0.3909654915332794, 0.49744531512260437, -0.7475903034210205, 0.42359334230422974, -0.8247535824775696, -1.7069671154022217, 0.40045884251594543, 0.34462231397628784, -0.09970729798078537, 0.2911204993724823, -0.02878781408071518, 0.1466412991285324, 0.2180497795343399, 0.3006833791732788...
javascript/reference/global_objects/map/getorinsertcomputed/index.md
JavaScript - Global Objects - Map - getOrInsertComputed - Syntax - Parameters: - `key`: The key of the element to return from the `Map` object. Object keys are compared by reference, not by value. - `callback`: A function that returns the value to insert and return if the key is not already present in the `Map` object...
[ -0.45303165912628174, 0.0539449043571949, -1.1095751523971558, 0.3061975836753845, -0.16852964460849762, -1.9599908590316772, 0.9271323084831238, 0.31972888112068176, -0.33731427788734436, 0.42245835065841675, -0.07122496515512466, 0.4893045127391815, -0.26879242062568665, 0.93863052129745...
javascript/reference/global_objects/map/getorinsertcomputed/index.md
JavaScript - Global Objects - Map - getOrInsertComputed - Syntax - Return value: The value associated with the specified key in the `Map` object. If the key can't be found, the result of `callback(key)` is inserted and returned.
[ -0.5375297665596008, 0.14677396416664124, -0.8686327934265137, 0.45268434286117554, -0.8209452629089355, -1.586242914199829, 0.8791543245315552, 0.4558725655078888, -0.17193862795829773, 0.3413364589214325, 0.3822324872016907, 0.9107661843299866, 0.19628870487213135, 1.2084227800369263, ...
javascript/reference/global_objects/map/getorinsertcomputed/index.md
JavaScript - Global Objects - Map - getOrInsertComputed - Syntax - Exceptions: - `TypeError`: Thrown if `callback` isn't callable.
[ -0.4517378807067871, 0.6634148955345154, -0.4862038493156433, 0.3719453811645508, -0.6267561316490173, -1.536902666091919, 0.30866822600364685, 0.4338741600513458, -0.45266178250312805, 0.3046569526195526, -0.05631105229258537, 0.19639912247657776, 0.3163803219795227, 0.11306395381689072, ...
javascript/reference/global_objects/map/getorinsertcomputed/index.md
JavaScript - Global Objects - Map - getOrInsertComputed - Examples - Avoiding unnecessary default computation: When using `Map.prototype.getOrInsert()`, the default value is computed every time, even if it is not needed. With `getOrInsertComputed()`, the default value is only computed when necessary. Example: const ...
[ -0.4500563442707062, -0.03837679326534271, -0.9995131492614746, 0.9320997595787048, -0.348484605550766, -1.4301508665084839, 0.26410341262817383, 0.07592267543077469, 0.038899220526218414, 0.5459538698196411, -0.38137421011924744, -0.03937947005033493, 0.03491755947470665, -0.2887224256992...
javascript/reference/global_objects/map/get/index.md
JavaScript - Global Objects - Map - get: The `get()` method of `Map` instances returns the value corresponding to the key in this `Map`, or `undefined` if there is none. Object values are returned as the same reference that was originally stored, not as a copy, so mutations to the returned object will be reflected any...
[ -0.2010190784931183, -0.4827095568180084, -1.74473237991333, 0.11305657774209976, -0.32135719060897827, -2.224076986312866, 0.8788374066352844, 0.354882150888443, -0.3109533488750458, 0.2843307554721832, -0.21440428495407104, 0.27469930052757263, 0.100240558385849, 0.6488438844680786, -0...
javascript/reference/global_objects/map/get/index.md
JavaScript - Global Objects - Map - get - Syntax: Example: get(key)
[ 0.40169966220855713, 0.28030726313591003, -1.7235338687896729, -0.5950747132301331, -1.0081748962402344, -2.4669485092163086, 0.18398772180080414, 0.6188603639602661, -0.572772741317749, -0.2325870543718338, 0.07881533354520798, 0.309623658657074, -0.3938291072845459, 0.5333020687103271, ...
javascript/reference/global_objects/map/get/index.md
JavaScript - Global Objects - Map - get - Syntax - Parameters: - `key`: The key of the value to return from the `Map` object. Object keys are compared by reference, not by value.
[ 0.030622195452451706, -0.18274995684623718, -1.5684195756912231, -0.6834613084793091, -0.4538315236568451, -2.1526734828948975, 0.8054842948913574, 0.6540018916130066, -0.3708931803703308, -0.4499981701374054, -0.38395845890045166, 0.5582762360572815, -0.5043416023254395, 0.981394708156585...