file
stringlengths
16
94
text
stringlengths
32
24.4k
vector
list
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...
javascript/reference/global_objects/map/get/index.md
JavaScript - Global Objects - Map - get - Syntax - Return value: The value associated with the specified key in the `Map` object. If the key can't be found, `undefined` is returned.
[ -0.4142362177371979, 0.04265822097659111, -1.0531586408615112, -0.30851608514785767, -0.8515132069587708, -1.5599499940872192, 0.917283296585083, 0.6197516322135925, -0.41360506415367126, 0.018451355397701263, 0.24226070940494537, 0.655561089515686, -0.24295125901699066, 0.9859354496002197...
javascript/reference/global_objects/map/get/index.md
JavaScript - Global Objects - Map - get - Examples - Using get(): Example: const myMap = new Map(); myMap.set("bar", "foo"); console.log(myMap.get("bar")); // Returns "foo" console.log(myMap.get("baz")); // Returns undefined
[ -0.20421530306339264, -0.2652919590473175, -1.3341002464294434, 0.137272447347641, -0.4657837748527527, -1.999860167503357, -0.047544192522764206, 0.0951840877532959, -0.2507557272911072, 0.17833200097084045, -0.44261330366134644, 0.32937464118003845, -0.11666379868984222, -0.0102091785520...
javascript/reference/global_objects/map/get/index.md
JavaScript - Global Objects - Map - get - Examples - Using get() to retrieve a reference to an object: Example: const arr = []; const myMap = new Map(); myMap.set("bar", arr); myMap.get("bar").push("foo"); console.log(arr); // ["foo"] console.log(myMap.get("bar")); // ["foo"]
[ -0.2580071687698364, -0.20469975471496582, -1.223721981048584, 0.2900402545928955, -0.5702695846557617, -2.2762796878814697, 0.4533291757106781, 0.21378502249717712, -0.35664620995521545, 0.14472827315330505, -0.5474808812141418, 0.3395027816295624, -0.527680516242981, 0.7241564393043518, ...
javascript/reference/global_objects/map/values/index.md
JavaScript - Global Objects - Map - values: The `values()` method of `Map` instances returns a new map iterator object that contains the values 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.values(); console.log(iterat...
[ 0.10822111368179321, -0.9750451445579529, -1.2526135444641113, 0.6676229238510132, 0.17743046581745148, -1.5231359004974365, 0.3199784457683563, 0.508510410785675, -0.3923061192035675, 0.3391706049442291, -0.06940816342830658, 0.607044517993927, 0.8718647360801697, 0.4978898763656616, 0....
javascript/reference/global_objects/map/values/index.md
JavaScript - Global Objects - Map - values - Syntax: Example: values()
[ 0.019857734441757202, -0.30155959725379944, -1.1294269561767578, -0.0844174474477768, -0.8670240044593811, -2.120347023010254, 1.190685749053955, 0.9046820402145386, -0.1495848298072815, -0.8440526723861694, 0.015592053532600403, 0.7221892476081848, 0.5279321670532227, -0.0904352068901062,...
javascript/reference/global_objects/map/values/index.md
JavaScript - Global Objects - Map - values - Syntax - Parameters: None.
[ -0.18571962416172028, 0.1967092603445053, -1.3159571886062622, -0.5922896265983582, -0.6354140043258667, -1.6659584045410156, 1.1696354150772095, 1.1119168996810913, -0.372231662273407, -0.7338579297065735, -0.5375524759292603, -0.5059042572975159, 0.3124989867210388, 0.021752864122390747,...
javascript/reference/global_objects/map/values/index.md
JavaScript - Global Objects - Map - values - Syntax - Return value: A new iterable iterator object.
[ -0.19142663478851318, 0.021281246095895767, -0.8440465331077576, -0.03904007375240326, -0.5386602282524109, -1.7678166627883911, 0.028203042224049568, 1.3383443355560303, -0.28340670466423035, 0.11867658793926239, -0.4392567276954651, 0.4120657742023468, 0.058163583278656006, 0.98039013147...
javascript/reference/global_objects/map/values/index.md
JavaScript - Global Objects - Map - values - Examples - Using values(): Example: const myMap = new Map(); myMap.set("0", "foo"); myMap.set(1, "bar"); myMap.set({}, "baz"); const mapIter = myMap.values(); console.log(mapIter.next().value); // "foo" console.log(mapIter.next().value); // "bar" console.log(mapIter.next...
[ -0.23126740753650665, -0.4500172734260559, -1.3557149171829224, 0.690765917301178, -0.4507361650466919, -2.139965772628784, 0.3152622878551483, 0.2886047065258026, 0.2985061705112457, 0.1356653869152069, -0.5082288980484009, 0.10296642780303955, 0.4487801492214203, -0.3514240086078644, 0...
javascript/reference/global_objects/map/delete/index.md
JavaScript - Global Objects - Map - delete: The `delete()` method of `Map` instances removes the entry specified by the key from this `Map`. Example: const map = new Map(); map.set("bar", "foo"); console.log(map.delete("bar")); // Expected result: true // True indicates successful removal console.log(map.has("bar"...
[ 0.16075295209884644, -0.7080135345458984, -1.0698859691619873, 0.3779856562614441, -0.10090304911136627, -2.509673833847046, 0.7319625616073608, -0.10749570280313492, -0.04032226279377937, 0.5956972241401672, -0.43470287322998047, -0.12275057286024094, 0.0878814309835434, 0.502444863319397...
javascript/reference/global_objects/map/delete/index.md
JavaScript - Global Objects - Map - delete - Syntax: Example: mapInstance.delete(key)
[ -0.23480500280857086, 0.1616171896457672, -0.5810138583183289, -0.2612609565258026, -0.535841166973114, -2.092960834503174, 0.828031063079834, 0.5952492952346802, 0.17783012986183167, -0.24433279037475586, -0.07609971612691879, 0.3047700822353363, 0.1414775401353836, 0.6431955099105835, ...
javascript/reference/global_objects/map/delete/index.md
JavaScript - Global Objects - Map - delete - Syntax - Parameters: - `key`: The key of the entry to remove from the `Map` object. Object keys are compared by reference, not by value.
[ -0.14343634247779846, -0.2720188796520233, -1.2009366750717163, -0.40155965089797974, -0.09415971487760544, -2.093500852584839, 0.9819450378417969, 0.620961606502533, 0.2915228605270386, -0.3501018285751343, -0.633102536201477, 0.08573751896619797, -0.5106789469718933, 0.7959575057029724, ...
javascript/reference/global_objects/map/delete/index.md
JavaScript - Global Objects - Map - delete - Syntax - Return value: `true` if an entry in the `Map` object has been removed successfully. `false` if the key is not found in the `Map`.
[ -0.7295326590538025, -0.1821444183588028, -0.7027449607849121, -0.12026524543762207, -0.31213465332984924, -2.2237389087677, 1.220009446144104, 0.3870045244693756, -0.5038736462593079, 0.30944836139678955, -0.31418395042419434, -0.20245718955993652, 0.17765435576438904, 0.6996803283691406,...
javascript/reference/global_objects/map/delete/index.md
JavaScript - Global Objects - Map - delete - Examples - Using delete(): Example: const myMap = new Map(); myMap.set("bar", "foo"); console.log(myMap.delete("bar")); // Returns true. Successfully removed. console.log(myMap.has("bar")); // Returns false. The "bar" element is no longer present.
[ -0.43271753191947937, -0.11009741574525833, -0.7129495143890381, 0.3901876211166382, -0.3566196858882904, -2.502107858657837, 0.4857200086116791, 0.1959313601255417, 0.2601271867752075, 0.5748804211616516, -0.26666831970214844, 0.12392722070217133, -0.04917207360267639, 0.32581406831741333...
javascript/reference/global_objects/map/entries/index.md
JavaScript - Global Objects - Map - entries: The `entries()` method of `Map` instances returns a new map iterator object that contains the `[key, value]` pairs 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.entries(); c...
[ 0.39682331681251526, -0.9457595944404602, -1.1994140148162842, 0.9305700063705444, 0.23103199899196625, -1.6371169090270996, 0.40049007534980774, 0.1529245227575302, -0.28544074296951294, 0.782600462436676, -0.24055837094783783, 0.22805480659008026, 0.6820070743560791, 0.5049000978469849, ...
javascript/reference/global_objects/map/entries/index.md
JavaScript - Global Objects - Map - entries - Syntax: Example: entries()
[ 0.6911500096321106, -0.5388948321342468, -1.1878169775009155, 0.5107730627059937, -0.8121500015258789, -2.277411699295044, 0.8191085457801819, 0.684519350528717, -0.13291458785533905, -0.31414076685905457, -0.13436777889728546, 0.2597730755805969, 0.2508173882961273, 0.11301463097333908, ...
javascript/reference/global_objects/map/entries/index.md
JavaScript - Global Objects - Map - entries - Syntax - Parameters: None.
[ 0.23247824609279633, 0.07321622967720032, -1.2261645793914795, -0.38192614912986755, -0.45898857712745667, -1.5147600173950195, 0.9976920485496521, 0.9778341054916382, -0.40875759720802307, -0.5331935882568359, -0.6011294722557068, -0.7297552227973938, 0.2751237154006958, 0.379586309194564...
javascript/reference/global_objects/map/entries/index.md
JavaScript - Global Objects - Map - entries - Syntax - Return value: A new iterable iterator object.
[ 0.016635090112686157, -0.1997087448835373, -0.894128680229187, -0.025808485224843025, -0.5031822323799133, -1.7908480167388916, 0.10203531384468079, 1.1693066358566284, -0.12208632379770279, 0.23581820726394653, -0.5365621447563171, 0.17651619017124176, -0.003187258029356599, 1.04778897762...
javascript/reference/global_objects/map/entries/index.md
JavaScript - Global Objects - Map - entries - Examples - Using entries(): Example: const myMap = new Map(); myMap.set("0", "foo"); myMap.set(1, "bar"); myMap.set({}, "baz"); const mapIter = myMap.entries(); console.log(mapIter.next().value); // ["0", "foo"] console.log(mapIter.next().value); // [1, "bar"] console.l...
[ 0.5391721129417419, -0.5189552903175354, -1.2786226272583008, 0.9654864072799683, -0.3328564167022705, -2.3511438369750977, 0.07471173256635666, -0.10117600113153458, 0.3897646963596344, 0.15833070874214172, -0.775783121585846, 0.14372707903385162, 0.3613182306289673, -0.17745745182037354,...
javascript/reference/global_objects/map/foreach/index.md
JavaScript - Global Objects - Map - forEach: The `forEach()` method of `Map` instances executes a provided function once per each key/value pair in this map, in insertion order. Example: function logMapElements(value, key, map) { console.log(`m[${key}] = ${value}`); } new Map([ ["foo", 3], ["bar", {}], ["ba...
[ 0.40109822154045105, -0.8753488659858704, -1.3331891298294067, -0.012531131505966187, -0.042425911873579025, -1.3356541395187378, 1.0188660621643066, 0.3454132378101349, -1.1968199014663696, 0.008034936152398586, -0.032063886523246765, 0.3595236837863922, 0.3913455009460449, 0.602160990238...
javascript/reference/global_objects/map/foreach/index.md
JavaScript - Global Objects - Map - forEach - Syntax: Example: forEach(callbackFn) forEach(callbackFn, thisArg)
[ 0.035083625465631485, 0.25001612305641174, -0.16020245850086212, -0.709302544593811, -0.9698088765144348, -2.9450080394744873, 1.381678581237793, 0.6258934736251831, -0.7627719640731812, -0.21873044967651367, -0.4971846342086792, 0.6483269929885864, -0.4709950089454651, 0.7845127582550049,...
javascript/reference/global_objects/map/foreach/index.md
JavaScript - Global Objects - Map - forEach - Syntax - Parameters: - `callbackFn`: A function to execute for each entry in the map. The function is called with the following arguments: - `value`: Value of each iteration. - `key`: Key of each iteration. - `map`: The map being iterated. - `thisArg` (optional): A v...
[ -0.1946989893913269, -0.08004689961671829, -0.8689077496528625, -0.21946948766708374, -0.3866143226623535, -2.1943466663360596, 1.5276163816452026, -0.23689670860767365, -0.7677653431892395, 0.278664767742157, -0.6914358735084534, 0.4644519090652466, -0.553106963634491, 1.3434566259384155,...
javascript/reference/global_objects/map/foreach/index.md
JavaScript - Global Objects - Map - forEach - Syntax - Return value: None (`undefined`).
[ -0.32682380080223083, 0.15045250952243805, -0.822182297706604, -1.1748040914535522, -0.6677969694137573, -1.7393226623535156, 1.5602489709854126, 0.9156897068023682, -0.9171016812324524, -0.0054506538435816765, -0.054347746074199677, 0.4441946744918823, 0.0466076023876667, 0.14121627807617...
javascript/reference/global_objects/map/foreach/index.md
JavaScript - Global Objects - Map - forEach - Description: The `forEach` method executes the provided `callback` once for each key of the map which actually exist. It is not invoked for keys which have been deleted. However, it is executed for values which are present but have the value `undefined`. `callback` is inv...
[ -0.5422540307044983, -0.13420309126377106, -0.9926570057868958, -0.018999960273504257, -0.19445326924324036, -1.933876872062683, 1.8472809791564941, 0.24906860291957855, -0.9591957926750183, 0.6249380707740784, 0.0665660873055458, 0.5298134684562683, 0.32965341210365295, 0.8172796368598938...
javascript/reference/global_objects/map/foreach/index.md
JavaScript - Global Objects - Map - forEach - Examples - Printing the contents of a Map object: The following code logs a line for each element in a `Map` object: Example: function logMapElements(value, key, map) { console.log(`map.get('${key}') = ${value}`); } new Map([ ["foo", 3], ["bar", {}], ["baz", unde...
[ -0.11894140392541885, 0.11901872605085373, -0.9710026383399963, 0.1651667207479477, 0.34549590945243835, -0.6760983467102051, 0.010740731842815876, 0.10223297029733658, -0.7694480419158936, 0.05214594677090645, -0.2489020824432373, 0.1646670401096344, 0.1711014360189438, 0.4993056058883667...
javascript/reference/global_objects/iterator/filter/index.md
JavaScript - Global Objects - Iterator - filter: The `filter()` method of `Iterator` instances returns a new iterator helper object that yields only those elements of the iterator for which the provided callback function returns `true`.
[ -0.7824289202690125, -0.5044354796409607, -1.3244768381118774, 0.44207948446273804, -0.1893405318260193, -1.5583281517028809, 0.2863422930240631, 0.8655991554260254, -1.4610917568206787, 0.6485388875007629, -0.7089744806289673, -0.42521029710769653, 0.07987818866968155, 1.143996238708496, ...
javascript/reference/global_objects/iterator/filter/index.md
JavaScript - Global Objects - Iterator - filter - Syntax: Example: filter(callbackFn)
[ -0.7498244643211365, 0.15828508138656616, -0.8902668952941895, -0.24118274450302124, -0.6524064540863037, -1.513576865196228, 0.4677768647670746, 0.6818650364875793, -1.279438853263855, 0.619208812713623, -0.42125460505485535, 0.32169172167778015, -0.6912463903427124, 1.2111777067184448, ...
javascript/reference/global_objects/iterator/filter/index.md
JavaScript - Global Objects - Iterator - filter - Syntax - Parameters: - `callbackFn`: A function to execute for each element produced by the iterator. It should return a truthy value to make the element yielded by the iterator helper, and a falsy value otherwise. The function is called with the following arguments: ...
[ -0.7606275081634521, -0.22433628141880035, -0.9466015100479126, -0.05757426097989082, -0.2322978675365448, -1.523711085319519, 0.20042498409748077, -0.08119108527898788, -0.90867680311203, 0.7366355657577515, -0.9073030352592468, 0.3122975528240204, -0.9600595831871033, 1.765557885169983, ...
javascript/reference/global_objects/iterator/filter/index.md
JavaScript - Global Objects - Iterator - filter - Syntax - Return value: A new iterator helper object. Each time the iterator helper's `next()` method is called, it returns the next element in the iterator for which the callback function returns `true`. When the underlying iterator is completed, the iterator helper ob...
[ -0.4050537049770355, -0.11315228790044785, -0.9113859534263611, 0.2539657950401306, -0.36696070432662964, -1.344659447669983, 0.34189489483833313, 1.0128942728042603, -0.6056638956069946, 0.5146340727806091, -0.19863329827785492, 0.057210102677345276, -0.004021961707621813, 1.0001853704452...
javascript/reference/global_objects/iterator/filter/index.md
JavaScript - Global Objects - Iterator - filter - Description: The main advantage of iterator helpers over array methods is that they are lazy, meaning that they only produce the next value when requested. This avoids unnecessary computation and also allows them to be used with infinite iterators.
[ 0.07510348409414291, 0.14598773419857025, -1.2024115324020386, 0.474526584148407, 0.19113261997699738, -1.5804486274719238, 0.029792819172143936, 0.6124392747879028, -0.370602011680603, 0.5691066980361938, -1.0145503282546997, -0.7599809765815735, -0.1412840038537979, 0.07267548143863678, ...
javascript/reference/global_objects/iterator/filter/index.md
JavaScript - Global Objects - Iterator - filter - Examples - Using filter(): The following example creates an iterator that yields terms in the Fibonacci sequence, and then reads the first few terms that are even: Example: function* fibonacci() { let current = 1; let next = 1; while (true) { yield current;...
[ -1.3447998762130737, 0.14520755410194397, -0.895099937915802, 0.37321531772613525, 0.28043684363365173, -1.019658088684082, -0.034643422812223434, 1.0882636308670044, -0.3917705714702606, 0.2031513899564743, -0.47161805629730225, 0.3021744191646576, -0.5339751243591309, 0.5081348419189453,...
javascript/reference/global_objects/iterator/filter/index.md
JavaScript - Global Objects - Iterator - filter - Examples - Using filter() with a for...of loop: `filter()` is most convenient when you are not hand-rolling the iterator. Because iterators are also iterable, you can iterate the returned helper with a `for...of` loop: Example: for (const n of fibonacci().filter((x) ...
[ -0.9168809652328491, -0.32407137751579285, -0.44551196694374084, 0.9974533319473267, 0.1820763200521469, -1.4843534231185913, -0.08948114514350891, 0.06377840787172318, -0.8131386041641235, 0.9476649165153503, 0.3744325637817383, 0.1630256474018097, -0.08777596056461334, 0.6757818460464478...
javascript/reference/global_objects/iterator/symbol.iterator/index.md
JavaScript - Global Objects - Iterator - Symbol.iterator: The `[Symbol.iterator]()` method of `Iterator` instances implements the iterable protocol and allows built-in iterators to be consumed by most syntaxes expecting iterables, such as the spread syntax and `for...of` loops. It returns the value of `this`, which is...
[ -0.3765213191509247, 0.22799129784107208, -0.4093402922153473, 0.6531385183334351, -0.07627465575933456, -1.7998285293579102, -0.14653651416301727, 1.4501346349716187, -0.4182210862636566, 0.2715896666049957, -0.7605155110359192, 0.8562673330307007, -0.27915826439857483, 0.6079425811767578...
javascript/reference/global_objects/iterator/symbol.iterator/index.md
JavaScript - Global Objects - Iterator - Symbol.iterator - Syntax: Example: iterator[Symbol.iterator]()
[ -0.14913587272167206, 0.2784838378429413, -0.4818302392959595, -0.3396318554878235, -0.4378601312637329, -1.94127357006073, -0.3274328112602234, 1.5760605335235596, -0.25020238757133484, -0.4162416458129883, -0.22108636796474457, 0.6790456771850586, -0.5287349820137024, 0.04648522287607193...
javascript/reference/global_objects/iterator/symbol.iterator/index.md
JavaScript - Global Objects - Iterator - Symbol.iterator - Syntax - Parameters: None.
[ -0.08311408758163452, 0.3763413429260254, -0.7359476685523987, -0.5520834922790527, -0.4934186041355133, -1.6353235244750977, -0.065143883228302, 1.7116336822509766, -0.5868775248527527, -0.5435002446174622, -0.6016245484352112, 0.09181574732065201, -0.27068057656288147, 0.2461598664522171...
javascript/reference/global_objects/iterator/symbol.iterator/index.md
JavaScript - Global Objects - Iterator - Symbol.iterator - Syntax - Return value: The value of `this`, which is the iterator object itself.
[ 0.03395456075668335, 0.2911809980869293, -0.6444164514541626, 0.013010298833251, -0.42956632375717163, -1.7932519912719727, -0.11380288004875183, 1.722249984741211, -0.09989867359399796, 0.0765664204955101, -0.5224661827087402, 1.2158336639404297, -0.3961769938468933, 0.8285036087036133, ...
javascript/reference/global_objects/iterator/symbol.iterator/index.md
JavaScript - Global Objects - Iterator - 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 built-in iterators iterable, and iterating syntaxes like the `for...of` loop automatically call this metho...
[ -0.18547292053699493, 0.3543255925178528, -0.13685743510723114, 0.830459713935852, 0.1419261395931244, -2.0259809494018555, -0.6781921982765198, 0.7330765724182129, -1.1159261465072632, 0.08909972757101059, 0.07125776261091232, 0.31311923265457153, -0.526502788066864, 0.6828721761703491, ...
javascript/reference/global_objects/iterator/take/index.md
JavaScript - Global Objects - Iterator - take: The `take()` method of `Iterator` instances returns a new iterator helper object that yields the given number of elements in this iterator and then terminates.
[ -0.09704750776290894, -0.4032779932022095, -0.9304714202880859, 0.057279039174318314, -0.30355116724967957, -1.4355465173721313, 0.515582263469696, 0.8673166036605835, -0.920660138130188, 0.6251245141029358, -0.6742554903030396, 0.010207078419625759, -0.8172913193702698, 1.190436840057373,...
javascript/reference/global_objects/iterator/take/index.md
JavaScript - Global Objects - Iterator - take - Syntax: Example: take(limit)
[ -0.3281405568122864, 0.07378669828176498, -0.8823118805885315, -0.4504343867301941, -0.8570157289505005, -1.6794664859771729, -0.04588840529322624, 1.1828278303146362, -0.586852490901947, 0.0497293658554554, -0.7656709551811218, 0.4199979603290558, -0.8102256655693054, 0.4555111527442932, ...
javascript/reference/global_objects/iterator/take/index.md
JavaScript - Global Objects - Iterator - take - Syntax - Parameters: - `limit`: The number of elements to take from the start of the iteration.
[ 0.04021736979484558, -0.14978128671646118, -0.9173325896263123, -0.6099885106086731, -0.6874201893806458, -1.3112843036651611, -0.2165510654449463, 0.9664133787155151, -0.5649141073226929, -0.09441237151622772, -1.4428073167800903, 0.15728747844696045, -1.0945509672164917, 0.72927087545394...
javascript/reference/global_objects/iterator/take/index.md
JavaScript - Global Objects - Iterator - take - Syntax - Return value: A new iterator helper object. The returned iterator helper yields the elements in the original iterator one-by-one, and then completes (the `next()` method produces `{ value: undefined, done: true }`) once `limit` elements have been yielded, or whe...
[ -0.21916188299655914, 0.05653688311576843, -0.8656051158905029, 0.21477265655994415, -0.4007677137851715, -1.6215459108352661, 0.3584975004196167, 1.3289847373962402, -0.5618013143539429, 0.43748369812965393, -0.6517807245254517, 0.25092819333076477, -1.1096000671386719, 1.252777338027954,...
javascript/reference/global_objects/iterator/take/index.md
JavaScript - Global Objects - Iterator - take - Syntax - Exceptions: - `RangeError`: Thrown if `limit` becomes `NaN` or negative when converted to an integer.
[ -0.9947449564933777, 0.18656684458255768, -0.20359943807125092, 0.0826437845826149, -0.603020429611206, -1.9363549947738647, -0.5743273496627808, 1.1286859512329102, -1.1149379014968872, 0.14582479000091553, -0.9064463376998901, -0.23090769350528717, -0.8898300528526306, -0.272388339042663...
javascript/reference/global_objects/iterator/take/index.md
JavaScript - Global Objects - Iterator - take - Examples - Using take(): The following example creates an iterator that yields terms in the Fibonacci sequence, and then logs the first three terms: Example: function* fibonacci() { let current = 1; let next = 1; while (true) { yield current; [current, ne...
[ -1.2335869073867798, 0.14502102136611938, -1.1663470268249512, 0.560585081577301, 0.11218979954719543, -0.9000658988952637, -0.09733115136623383, 1.33079993724823, -0.6743191480636597, 0.1334974616765976, -0.5832036137580872, 0.7846344709396362, -0.7380243539810181, 0.3887559175491333, 0...
javascript/reference/global_objects/iterator/take/index.md
JavaScript - Global Objects - Iterator - take - Examples - Using take() with a for...of loop: `take()` is most convenient when you are not hand-rolling the iterator. Because iterators are also iterable, you can iterate the returned helper with a `for...of` loop: Example: for (const n of fibonacci().take(5)) { cons...
[ -0.7757663726806641, 0.16284574568271637, -0.5158767104148865, 1.2645972967147827, -0.268104612827301, -1.54240882396698, 0.32469865679740906, 0.32883644104003906, -0.6221057176589966, 0.9632085561752319, 0.01096111536026001, 0.3131657540798187, -0.42366257309913635, 0.45025935769081116, ...
javascript/reference/global_objects/iterator/take/index.md
JavaScript - Global Objects - Iterator - take - Examples - Combining drop() with take(): You can combine `take()` with `Iterator.prototype.drop()` to get a slice of an iterator: Example: for (const n of fibonacci().drop(2).take(5)) { // Drops the first two elements, then takes the next five console.log(n); } // ...
[ -0.45851725339889526, -0.527281641960144, -0.7137004137039185, 0.6429382562637329, 0.09688379615545273, -0.9046211838722229, 0.5134731531143188, 0.7994868159294128, -1.2581214904785156, 0.8963779807090759, -0.253456711769104, 0.45722338557243347, -0.7515032887458801, 0.5391473770141602, ...
javascript/reference/global_objects/iterator/take/index.md
JavaScript - Global Objects - Iterator - take - Examples - Lower and upper bounds of take count: When the `limit` is negative or `NaN`, a `RangeError` is thrown: Example: fibonacci().take(-1); // RangeError: -1 must be positive fibonacci().take(undefined); // RangeError: undefined must be positive When the `limit` ...
[ -1.1417982578277588, -0.36953064799308777, -0.8764115571975708, 0.4919885993003845, 0.11546587198972702, -1.744511365890503, -0.20157736539840698, 0.9478892087936401, -1.5217444896697998, 0.22608034312725067, -1.1674292087554932, 0.1745130568742752, -0.9109069108963013, 0.3286939561367035,...
javascript/reference/global_objects/iterator/flatmap/index.md
JavaScript - Global Objects - Iterator - flatMap: The `flatMap()` method of `Iterator` instances returns a new iterator helper object that takes each element in the original iterator, runs it through a mapping function, and yields elements returned by the mapping function (which are contained in another iterator or it...
[ -0.6206418871879578, -0.42081138491630554, -1.447089672088623, 0.4178721010684967, 0.20657503604888916, -1.1994426250457764, 0.9262385368347168, 0.8794021010398865, -1.0283641815185547, 0.2568759024143219, -0.6076506972312927, 0.16130875051021576, -0.5266891717910767, 1.1343061923980713, ...
javascript/reference/global_objects/iterator/flatmap/index.md
JavaScript - Global Objects - Iterator - flatMap - Syntax: Example: flatMap(callbackFn)
[ -1.0021274089813232, 0.35238516330718994, -0.9995194673538208, -0.261410653591156, -0.4464481770992279, -1.6657992601394653, 1.290705680847168, 0.6801056265830994, -1.2123610973358154, 0.33606502413749695, -0.34012657403945923, 0.5950936675071716, -0.8931862115859985, 1.0341144800186157, ...
javascript/reference/global_objects/iterator/flatmap/index.md
JavaScript - Global Objects - Iterator - flatMap - Syntax - Parameters: - `callbackFn`: A function to execute for each element produced by the iterator. It should return an iterator or iterable that yields elements to be yielded by `flatMap()`. Note that unlike `Array.prototype.flatMap()`, you cannot return single non...
[ -1.0274971723556519, -0.30162885785102844, -1.0598686933517456, -0.003164695343002677, -0.09054196625947952, -1.3660821914672852, 0.640842616558075, 0.397238165140152, -0.9276019930839539, 0.6639018654823303, -0.5814016461372375, 0.5726569890975952, -1.1028615236282349, 1.8739436864852905,...
javascript/reference/global_objects/iterator/flatmap/index.md
JavaScript - Global Objects - Iterator - flatMap - Syntax - Return value: A new iterator helper object. The first time the iterator helper's `next()` method is called, it calls `callbackFn` on the first element produced by the underlying iterator, and the return value, which should be an iterator or iterable, is yield...
[ -0.6623662114143372, 0.2224518209695816, -1.0341523885726929, 0.23767352104187012, -0.2688176929950714, -1.207999348640442, 0.5882686376571655, 0.7863218188285828, -0.8314716219902039, 0.6718971729278564, -0.1284596025943756, 0.3986402750015259, -1.0052357912063599, 1.4140827655792236, -...
javascript/reference/global_objects/iterator/flatmap/index.md
JavaScript - Global Objects - Iterator - flatMap - Syntax - Exceptions: - `TypeError`: Thrown if `callbackFn` returns a non-iterator/iterable value or a string primitive.
[ -0.8961828351020813, 0.24077093601226807, -0.7468839287757874, -0.16763125360012054, -0.4428849220275879, -1.6262264251708984, 0.9249655604362488, 0.4145199656486511, -0.9960630536079407, 0.4919893145561218, -0.32954150438308716, -0.001377027714625001, -0.9442655444145203, 0.52906119823455...
javascript/reference/global_objects/iterator/flatmap/index.md
JavaScript - Global Objects - Iterator - flatMap - Description: `flatMap` accepts two kinds of return values from `callbackFn`: an iterator or iterable. They are handled in the same way as `Iterator.from()`: if the return value is iterable, the `[Symbol.iterator]()` method is called and the return value is used; other...
[ -1.3023015260696411, -0.19696593284606934, -0.8607020378112793, 0.12995967268943787, 0.038205526769161224, -1.3330100774765015, 0.7644530534744263, 0.8363926410675049, -1.0282137393951416, 0.8107985854148865, -0.11626604199409485, 0.5991320610046387, -0.1193200945854187, 0.7949443459510803...