file stringlengths 16 94 | text stringlengths 32 24.4k | vector list |
|---|---|---|
javascript/reference/global_objects/disposablestack/move/index.md | JavaScript - Global Objects - DisposableStack - move - Examples - Claiming ownership of a stack:
Example:
function consumeStack(stack) {
using newStack = stack.move(); // newStack now owns the disposers
console.log(stack.disposed); // true
console.log(newStack.disposed); // false
// newStack is disposed here ... | [
0.31619590520858765,
-0.2570650279521942,
-1.1994069814682007,
0.3790832757949829,
-0.3330910801887512,
-1.5004619359970093,
-0.1852172613143921,
0.34077921509742737,
-0.3028440475463867,
0.5452215671539307,
0.06926713138818741,
0.22923018038272858,
-1.0380363464355469,
0.29798269271850586... |
javascript/reference/global_objects/disposablestack/move/index.md | JavaScript - Global Objects - DisposableStack - move - Examples - Allowing resources to be disposed within two code paths:
The major use case of `move()` is when you have one or more resources which could either be disposed right here or could be persisted for later use. In this case, you can put the resources in a `D... | [
0.08433917164802551,
0.14201070368289948,
-0.2705886662006378,
1.2773960828781128,
0.4243347942829132,
-0.3102114498615265,
-0.7378479838371277,
0.406883180141449,
-0.6330453753471375,
0.10506980866193771,
-0.4960220456123352,
0.45724278688430786,
-0.7669115662574768,
0.051157478243112564,... |
javascript/reference/global_objects/set/symbol.species/index.md | JavaScript - Global Objects - Set - Symbol.species:
The `Set[Symbol.species]` static accessor property is an unused accessor property specifying how to copy `Set` objects. | [
-1.4985684156417847,
-0.19033212959766388,
-1.9012081623077393,
0.44470492005348206,
-0.579789936542511,
-2.523268938064575,
0.3008544445037842,
1.3259352445602417,
0.4475783109664917,
-0.3758128583431244,
-1.0817838907241821,
0.38597479462623596,
-0.2583373785018921,
0.34903839230537415,
... |
javascript/reference/global_objects/set/symbol.species/index.md | JavaScript - Global Objects - Set - Symbol.species - Syntax:
Example:
Set[Symbol.species] | [
-0.7902635335922241,
-0.05610212683677673,
-1.4015229940414429,
-0.20658782124519348,
-1.1209155321121216,
-2.5443713665008545,
-0.36040839552879333,
1.4433979988098145,
-0.004543860908597708,
-0.9408080577850342,
-0.4247969686985016,
1.0653210878372192,
0.006687322165817022,
0.50019735097... |
javascript/reference/global_objects/set/symbol.species/index.md | JavaScript - Global Objects - Set - 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 `Set` instances. | [
-0.959584653377533,
0.27688905596733093,
-1.2053189277648926,
0.6800416707992554,
-0.7361185550689697,
-2.296790599822998,
0.15851517021656036,
1.2481135129928589,
-0.16647562384605408,
-0.1767420768737793,
-0.8190503716468811,
1.366426706314087,
-0.35009658336639404,
1.1269205808639526,
... |
javascript/reference/global_objects/set/symbol.species/index.md | JavaScript - Global Objects - Set - Symbol.species - Description:
The `[Symbol.species]` accessor property returns the default constructor for `Set` objects. Subclass constructors may override it to change the constructor assignment.
Note: This property is currently unused by all `Set` methods. | [
-1.7631769180297852,
-0.6081520915031433,
-1.836535930633545,
0.7636655569076538,
-0.7308617830276489,
-2.5167958736419678,
0.06392189860343933,
0.7291011810302734,
0.11449770629405975,
-0.7070668935775757,
-0.4730864465236664,
1.0319267511367798,
-0.06761190295219421,
0.49060529470443726,... |
javascript/reference/global_objects/set/symbol.species/index.md | JavaScript - Global Objects - Set - Symbol.species - Examples - Species in ordinary objects:
The `[Symbol.species]` property returns the default constructor function, which is the `Set` constructor for `Set`.
Example:
Set[Symbol.species]; // function Set() | [
-1.3814427852630615,
0.15437935292720795,
-2.0815796852111816,
0.3389732241630554,
-0.4903998076915741,
-2.3443689346313477,
-0.492343008518219,
0.8901310563087463,
-0.24041037261486053,
-0.5661225914955139,
-0.5766750574111938,
0.9256970286369324,
0.10219734162092209,
0.21638503670692444,... |
javascript/reference/global_objects/set/symbol.species/index.md | JavaScript - Global Objects - Set - Symbol.species - Examples - Species in derived objects:
In an instance of a custom `Set` subclass, such as `MySet`, the `MySet` species is the `MySet` constructor. However, you might want to overwrite this, in order to return parent `Set` objects in your derived class methods:
Exam... | [
-0.7628999352455139,
-0.08426439762115479,
-0.7751094698905945,
0.5619134902954102,
0.1296989619731903,
-1.827716588973999,
-0.09510777145624161,
1.0730360746383667,
-0.5839301347732544,
0.26359373331069946,
-0.8576356172561646,
0.6893628239631653,
-0.06992655247449875,
-0.0090447915717959... |
javascript/reference/global_objects/set/set/index.md | JavaScript - Global Objects - Set:
The `Set()` constructor creates `Set` objects.
Example:
const set = new Set([1, 2, 3, 4, 5]);
console.log(set.has(1));
// Expected output: true
console.log(set.has(5));
// Expected output: true
console.log(set.has(6));
// Expected output: false | [
-0.4418107271194458,
-0.6163086295127869,
-2.036296844482422,
1.2667779922485352,
0.011809982359409332,
-1.8204867839813232,
-1.2464606761932373,
0.6618982553482056,
0.0685935914516449,
-0.23685497045516968,
-0.8423246741294861,
0.36695727705955505,
-0.15810410678386688,
-0.076230868697166... |
javascript/reference/global_objects/set/set/index.md | JavaScript - Global Objects - Set - Syntax:
Example:
new Set()
new Set(iterable)
Note: `Set()` can only be constructed with `new`. Attempting to call it without `new` throws a `TypeError`. | [
-0.4530295729637146,
0.1815108060836792,
-0.7993528842926025,
0.9349772930145264,
-0.06733725965023041,
-1.6428865194320679,
-0.8812923431396484,
1.605348825454712,
-0.2699125409126282,
-0.5550907254219055,
-0.30255281925201416,
0.5541764497756958,
0.3184276521205902,
0.06887558847665787,
... |
javascript/reference/global_objects/set/set/index.md | JavaScript - Global Objects - Set - Syntax - Parameters:
- `iterable` (optional): If an iterable object (such as an array) is passed, all of its elements will be added to the new `Set`. If you don't specify this parameter, or its value is `null` or `undefined`, the new `Set` is empty. | [
-0.408545583486557,
0.22794538736343384,
-1.2028661966323853,
0.9775316715240479,
0.07238947600126266,
-2.1768155097961426,
0.7872216701507568,
0.8128462433815002,
-0.5073080658912659,
-0.2533492147922516,
-0.6616934537887573,
0.11723559349775314,
-0.08660810440778732,
0.7029209733009338,
... |
javascript/reference/global_objects/set/set/index.md | JavaScript - Global Objects - Set - Syntax - Return value:
A new `Set` object. | [
-0.3228476941585541,
-0.3830995261669159,
-1.867643117904663,
0.04190053045749664,
-0.4191212058067322,
-1.7294878959655762,
-0.1220841184258461,
1.6282871961593628,
0.10150627046823502,
-0.5074802041053772,
-0.31146886944770813,
0.8498153686523438,
-0.06788177043199539,
1.045080542564392,... |
javascript/reference/global_objects/set/set/index.md | JavaScript - Global Objects - Set - Examples - Using the `Set` object:
Example:
const mySet = new Set();
mySet.add(1); // Set [ 1 ]
mySet.add(5); // Set [ 1, 5 ]
mySet.add(5); // Set [ 1, 5 ]
mySet.add("some text"); // Set [ 1, 5, 'some text' ]
const o = { a: 1, b: 2 };
mySet.add(o); | [
-0.6971394419670105,
0.06285710632801056,
-1.3111621141433716,
0.9174925088882446,
-0.14867495000362396,
-1.7342863082885742,
-0.34007027745246887,
0.8126260638237,
0.11823976784944534,
-0.24759449064731598,
-0.986858069896698,
0.41101887822151184,
-0.1892203837633133,
-0.10875328630208969... |
javascript/reference/global_objects/set/size/index.md | JavaScript - Global Objects - Set - size:
The `size` accessor property of `Set` instances returns the number of (unique) elements in this set.
Example:
const set = new Set();
const object = {};
set.add(42);
set.add("forty two");
set.add("forty two");
set.add(object);
console.log(set.size);
// Expected output: 3 | [
-0.7239075899124146,
-0.7176616191864014,
-2.088322401046753,
0.6329616904258728,
-0.7926449179649353,
-1.0144293308258057,
-0.3004068434238434,
0.04200047254562378,
0.1458868533372879,
-0.48889702558517456,
-0.8775448799133301,
0.811886727809906,
-0.21437135338783264,
0.3295252323150635,
... |
javascript/reference/global_objects/set/size/index.md | JavaScript - Global Objects - Set - size - Description:
The value of `size` is an integer representing how many entries the `Set` object has. A set accessor function for `size` is `undefined`; you cannot change this property. | [
-0.8700496554374695,
-0.6076241731643677,
-1.911587119102478,
0.29152554273605347,
-0.685422420501709,
-1.463169813156128,
0.41315779089927673,
0.459358811378479,
0.14120851457118988,
-0.8361637592315674,
-0.7121359705924988,
0.4357188940048218,
-0.01791912131011486,
-0.08667130768299103,
... |
javascript/reference/global_objects/set/size/index.md | JavaScript - Global Objects - Set - size - Examples - Using size:
Example:
const mySet = new Set();
mySet.add(1);
mySet.add(5);
mySet.add("some text");
console.log(mySet.size); // 3 | [
-1.0652549266815186,
0.014888286590576172,
-1.5820192098617554,
0.36658337712287903,
-0.6463680267333984,
-1.3826528787612915,
-0.29960545897483826,
0.2925253212451935,
0.03459984064102173,
-0.5045009255409241,
-0.8094735145568848,
0.9805305600166321,
-0.37830284237861633,
-0.5480991601943... |
javascript/reference/global_objects/set/has/index.md | JavaScript - Global Objects - Set - has:
The `has()` method of `Set` instances returns a boolean indicating whether the specified value exists in this `Set` or not.
Example:
const set = new Set([1, 2, 3, 4, 5]);
console.log(set.has(1));
// Expected output: true
console.log(set.has(5));
// Expected output: true
co... | [
-0.310302197933197,
-1.1984519958496094,
-1.9653122425079346,
1.2561216354370117,
0.05260937288403511,
-2.102445602416992,
0.06185843423008919,
0.5205609798431396,
-0.31489670276641846,
-0.2732628881931305,
-0.8311576247215271,
0.33810460567474365,
0.5268176794052124,
-0.01804676465690136,... |
javascript/reference/global_objects/set/has/index.md | JavaScript - Global Objects - Set - has - Syntax:
Example:
has(value) | [
0.3660428822040558,
-0.16104242205619812,
-1.468780279159546,
0.4253078103065491,
-0.7703441381454468,
-2.1375892162323,
0.578021228313446,
0.9730226397514343,
-0.6604730486869812,
-0.5373113751411438,
-0.3847278356552124,
0.7600440979003906,
-0.0029478748328983784,
-0.07138650119304657,
... |
javascript/reference/global_objects/set/has/index.md | JavaScript - Global Objects - Set - has - Syntax - Parameters:
- `value`: The value to test for presence in the `Set` object. | [
-0.08488191664218903,
-0.41981494426727295,
-1.1962599754333496,
0.3627803325653076,
-0.10842376202344894,
-2.187448740005493,
0.6548053026199341,
0.8172745704650879,
-0.09537120163440704,
-0.5462120771408081,
-0.7456960678100586,
0.7933268547058105,
-0.26941996812820435,
0.373868286609649... |
javascript/reference/global_objects/set/has/index.md | JavaScript - Global Objects - Set - has - Syntax - Return value:
Returns `true` if the specified value exists in the `Set` object; otherwise `false`. | [
-0.6998767852783203,
-0.33800339698791504,
-1.2540159225463867,
0.7805178165435791,
-0.6815277934074402,
-2.1178853511810303,
0.6038457751274109,
0.9280924201011658,
-0.802711546421051,
-0.31755417585372925,
-0.7202862501144409,
0.5259977579116821,
0.05061349645256996,
0.5648120641708374,
... |
javascript/reference/global_objects/set/has/index.md | JavaScript - Global Objects - Set - has - Examples - Using has():
Example:
const mySet = new Set();
mySet.add("foo");
console.log(mySet.has("foo")); // true
console.log(mySet.has("bar")); // false
const set = new Set();
const obj = { key1: 1 };
set.add(obj);
console.log(set.has(obj)); // true
console.log(set.has({... | [
-0.13684478402137756,
-0.6190513372421265,
-2.014960289001465,
1.1887030601501465,
-0.400547593832016,
-1.9415680170059204,
-0.29820722341537476,
0.40245431661605835,
-0.34792080521583557,
-0.08963388949632645,
-0.7721109986305237,
0.06755995750427246,
-0.03775431215763092,
-0.079581417143... |
javascript/reference/global_objects/set/keys/index.md | JavaScript - Global Objects - Set - keys:
The `keys()` method of `Set` instances is an alias for the `values()` method. | [
0.5072154998779297,
-0.3127371370792389,
-1.8998833894729614,
1.0062012672424316,
-0.5100733637809753,
-1.8615591526031494,
0.5960339903831482,
0.8736119270324707,
0.014616710133850574,
-0.4157916009426117,
-0.5124778747558594,
0.12288594990968704,
0.48646780848503113,
0.736038327217102,
... |
javascript/reference/global_objects/set/keys/index.md | JavaScript - Global Objects - Set - keys - Syntax:
Example:
keys() | [
0.08052001893520355,
-0.09484289586544037,
-1.7377336025238037,
0.3040851354598999,
-0.8460739850997925,
-1.9287399053573608,
0.6779444217681885,
1.2322556972503662,
-0.4993587136268616,
-0.665719211101532,
-0.10474230349063873,
0.779864490032196,
-0.22851437330245972,
0.45389074087142944,... |
javascript/reference/global_objects/set/keys/index.md | JavaScript - Global Objects - Set - keys - Syntax - Parameters:
None. | [
-0.0139007568359375,
0.38913148641586304,
-1.8289690017700195,
-0.39026355743408203,
-0.6046480536460876,
-1.414987325668335,
0.8433558940887451,
1.267386555671692,
-0.46791547536849976,
-0.7275320291519165,
-0.59074866771698,
-0.17836414277553558,
-0.1265183985233307,
0.44241297245025635,... |
javascript/reference/global_objects/set/keys/index.md | JavaScript - Global Objects - Set - keys - Syntax - Return value:
A new iterable iterator object. | [
-0.2715074121952057,
-0.03223337605595589,
-1.2878673076629639,
0.10605259239673615,
-0.456442654132843,
-1.7507563829421997,
-0.177300825715065,
1.5148053169250488,
-0.40051963925361633,
0.10847792029380798,
-0.4548474848270416,
0.5086095929145813,
-0.2528094947338104,
1.086290717124939,
... |
javascript/reference/global_objects/set/keys/index.md | JavaScript - Global Objects - Set - keys - Examples - Using keys():
The `keys()` method is exactly equivalent to the `values()` method.
Example:
const mySet = new Set();
mySet.add("foo");
mySet.add("bar");
mySet.add("baz");
const setIter = mySet.keys();
console.log(setIter.next().value); // "foo"
console.log(setIt... | [
-0.1288641393184662,
-0.32930561900138855,
-2.048729658126831,
1.3682760000228882,
-0.42288267612457275,
-1.8166955709457397,
0.009788515977561474,
0.7889896035194397,
0.04547281935811043,
0.18000522255897522,
-0.5862432718276978,
0.5096508264541626,
0.35062578320503235,
0.3034755885601043... |
javascript/reference/global_objects/set/symbol.iterator/index.md | JavaScript - Global Objects - Set - Symbol.iterator:
The `[Symbol.iterator]()` method of `Set` instances implements the iterable protocol and allows `Set` objects to be consumed by most syntaxes expecting iterables, such as the spread syntax and `for...of` loops. It returns a set iterator object that yields the values... | [
-0.5023741722106934,
-0.26866963505744934,
-1.412670612335205,
0.9827443957328796,
0.23219019174575806,
-1.628754734992981,
-1.098565936088562,
1.1716537475585938,
-0.07557191699743271,
-0.10623089969158173,
-0.8819237351417542,
0.9550428986549377,
-0.06726941466331482,
0.43963199853897095... |
javascript/reference/global_objects/set/symbol.iterator/index.md | JavaScript - Global Objects - Set - Symbol.iterator - Syntax:
Example:
set[Symbol.iterator]() | [
-0.4918772280216217,
0.12126651406288147,
-0.8153206706047058,
-0.07578279078006744,
-0.3781076967716217,
-2.2109475135803223,
-0.8605624437332153,
1.5139662027359009,
0.06678907573223114,
-0.8559443354606628,
-0.16144110262393951,
1.0614254474639893,
-0.2064049392938614,
0.219739794731140... |
javascript/reference/global_objects/set/symbol.iterator/index.md | JavaScript - Global Objects - Set - Symbol.iterator - Syntax - Parameters:
None. | [
-0.3143324553966522,
0.16558218002319336,
-1.0674246549606323,
-0.40600401163101196,
-0.36469265818595886,
-1.9284802675247192,
-0.4409613013267517,
1.6267393827438354,
-0.3296082615852356,
-0.7077778577804565,
-0.5924437046051025,
0.30748534202575684,
-0.22641107439994812,
0.3977177739143... |
javascript/reference/global_objects/set/symbol.iterator/index.md | JavaScript - Global Objects - Set - Symbol.iterator - Syntax - Return value:
The same return value as `Set.prototype.values()`: a new iterable iterator object that yields the values of the set. | [
-0.701108455657959,
-0.06859102845191956,
-1.2409769296646118,
0.4885779023170471,
-0.22674360871315002,
-1.7600828409194946,
-0.589697003364563,
1.936437964439392,
-0.5393803119659424,
-0.11680932343006134,
-0.6212941408157349,
1.090506672859192,
-0.0352247916162014,
0.8715792298316956,
... |
javascript/reference/global_objects/set/symbol.iterator/index.md | JavaScript - Global Objects - Set - 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 `Set` objects iterable, and iterating syntaxes like the `for...of` loop automatically call this method to obtai... | [
-0.7313150763511658,
0.18462759256362915,
-0.5623034238815308,
1.213831901550293,
0.31691914796829224,
-2.198603630065918,
-0.8410668969154358,
0.8339941501617432,
-0.6022486090660095,
-0.02951178327202797,
-0.3549720346927643,
0.5682165622711182,
-0.6292443871498108,
0.6647529602050781,
... |
javascript/reference/global_objects/set/symbol.iterator/index.md | JavaScript - Global Objects - Set - 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 mySet = new Set();
mySet.add("0");
mySet.add(1);
mySet.add({});
c... | [
-0.7761223912239075,
0.060236670076847076,
-1.0705057382583618,
0.5355160236358643,
-0.08390723168849945,
-1.6716394424438477,
-0.7926458716392517,
0.7330805063247681,
-0.672206461429596,
0.49429553747177124,
-0.3794149160385132,
0.8413608074188232,
-0.3786170780658722,
0.19031859934329987... |
javascript/reference/global_objects/set/add/index.md | JavaScript - Global Objects - Set - add:
The `add()` method of `Set` instances inserts the specified value into this set, if it is not already present.
Example:
const set = new Set();
set.add(42);
set.add(42);
set.add(13);
for (const item of set) {
console.log(item);
// Expected output: 42
// Expected output... | [
-0.4262043237686157,
-0.6181167960166931,
-1.640760064125061,
1.1805510520935059,
-0.2798348367214203,
-1.190325379371643,
-0.19106672704219818,
0.5785771608352661,
-0.12595583498477936,
-0.43169379234313965,
-0.566998302936554,
0.14730022847652435,
-0.13012520968914032,
0.3957870304584503... |
javascript/reference/global_objects/set/add/index.md | JavaScript - Global Objects - Set - add - Syntax:
Example:
add(value) | [
0.21105574071407318,
-0.045000795274972916,
-1.1137886047363281,
0.3907608389854431,
-1.0696152448654175,
-1.6850862503051758,
0.8311517834663391,
1.2062534093856812,
-0.11398719996213913,
-0.9430007338523865,
-0.3308972120285034,
0.7333870530128479,
-0.32297590374946594,
0.174419611692428... |
javascript/reference/global_objects/set/add/index.md | JavaScript - Global Objects - Set - add - Syntax - Parameters:
- `value`: The value to add to the `Set` object. Objects are compared by reference, not by value. | [
-0.07607846707105637,
-0.26453280448913574,
-1.2239753007888794,
0.3035513460636139,
-0.592221736907959,
-1.6496543884277344,
0.8212229609489441,
1.077634334564209,
0.30977633595466614,
-1.1676509380340576,
-0.6718670129776001,
0.8997058868408203,
-0.5479569435119629,
0.5837172865867615,
... |
javascript/reference/global_objects/set/add/index.md | JavaScript - Global Objects - Set - add - Syntax - Return value:
The `Set` object. | [
-0.1483936458826065,
-0.04673464223742485,
-1.7538701295852661,
-0.10319911688566208,
-0.6403762102127075,
-1.5157411098480225,
0.317984014749527,
1.104072093963623,
0.017714016139507294,
-0.6872073411941528,
-0.30355992913246155,
1.0410211086273193,
-0.2382689118385315,
0.7156568169593811... |
javascript/reference/global_objects/set/add/index.md | JavaScript - Global Objects - Set - add - Examples - Using add():
Example:
const mySet = new Set();
mySet.add(1);
mySet.add(5).add("some text"); // chainable
console.log(mySet);
// Set [1, 5, "some text"] | [
-0.7970490455627441,
-0.19488205015659332,
-1.2786409854888916,
0.6170296669006348,
-0.5665018558502197,
-1.3840364217758179,
-0.36421963572502136,
1.0590989589691162,
-0.4731315076351166,
-0.3237476944923401,
-1.1499147415161133,
0.08375813812017441,
-0.5237494707107544,
0.149588674306869... |
javascript/reference/global_objects/set/clear/index.md | JavaScript - Global Objects - Set - clear:
The `clear()` method of `Set` instances removes all elements from this set.
Example:
const set = new Set();
set.add(1);
set.add("foo");
console.log(set.size);
// Expected output: 2
set.clear();
console.log(set.size);
// Expected output: 0 | [
-0.2197328358888626,
-0.31483542919158936,
-2.0637941360473633,
0.26548606157302856,
0.24661709368228912,
-1.9637318849563599,
-0.06218807026743889,
0.4546867609024048,
-0.036664675921201706,
0.1341213434934616,
-0.6810923218727112,
0.38583263754844666,
0.0981016531586647,
0.35044384002685... |
javascript/reference/global_objects/set/clear/index.md | JavaScript - Global Objects - Set - clear - Syntax:
Example:
clear() | [
-0.14346277713775635,
0.10307887196540833,
-1.3470890522003174,
-0.5151646733283997,
-0.3875495493412018,
-1.874576449394226,
0.219502791762352,
1.2738468647003174,
-0.1639162302017212,
-0.5928642749786377,
0.1663968861103058,
0.6122724413871765,
0.010390679351985455,
0.09949198365211487,
... |
javascript/reference/global_objects/set/clear/index.md | JavaScript - Global Objects - Set - clear - Syntax - Parameters:
None. | [
-0.23683397471904755,
0.12676642835140228,
-1.6005419492721558,
-0.7220024466514587,
-0.5029656291007996,
-1.659517526626587,
0.7395949959754944,
1.1076985597610474,
-0.18430748581886292,
-0.5983784794807434,
-0.49329042434692383,
-0.12188554555177689,
-0.04113240912556648,
0.2762382626533... |
javascript/reference/global_objects/set/clear/index.md | JavaScript - Global Objects - Set - clear - Syntax - Return value:
None (`undefined`). | [
-0.6391228437423706,
0.3040293753147125,
-1.4451353549957275,
-0.8611425757408142,
-0.6579949259757996,
-1.4606690406799316,
0.7567657232284546,
1.0283125638961792,
-0.5004575252532959,
-0.06546593457460403,
0.0300435870885849,
0.3277851939201355,
0.15681438148021698,
0.2941208481788635,
... |
javascript/reference/global_objects/set/clear/index.md | JavaScript - Global Objects - Set - clear - Examples - Using the clear() method:
Example:
const mySet = new Set();
mySet.add(1);
mySet.add("foo");
console.log(mySet.size); // 2
console.log(mySet.has("foo")); // true
mySet.clear();
console.log(mySet.size); // 0
console.log(mySet.has("foo")); // false | [
-0.8923740386962891,
-0.310224711894989,
-1.3951929807662964,
0.3586324453353882,
0.08958306908607483,
-1.9045536518096924,
-0.10197080671787262,
0.7155149579048157,
-0.07458410412073135,
0.03628987446427345,
-0.3039337694644928,
0.6650717258453369,
0.0050992718897759914,
-0.14683789014816... |
javascript/reference/global_objects/set/values/index.md | JavaScript - Global Objects - Set - values:
The `values()` method of `Set` instances returns a new set iterator object that contains the values for each element in this set in insertion order.
Example:
const set = new Set();
set.add(42);
set.add("forty two");
const iterator = set.values();
console.log(iterator.nex... | [
-0.22610904276371002,
-0.9840750694274902,
-1.6057624816894531,
1.0489166975021362,
0.19703397154808044,
-1.3164381980895996,
-0.3820372223854065,
0.775546133518219,
-0.14696410298347473,
-0.39870116114616394,
-0.11944673955440521,
0.7854418158531189,
0.6434257626533508,
0.4777331352233886... |
javascript/reference/global_objects/set/values/index.md | JavaScript - Global Objects - Set - values - Syntax:
Example:
values() | [
-0.2599094808101654,
-0.35208597779273987,
-1.3627241849899292,
0.12130111455917358,
-0.8713616728782654,
-1.9491088390350342,
0.7762562036514282,
1.237284541130066,
0.02463449537754059,
-1.1267642974853516,
-0.18159103393554688,
0.9128555059432983,
0.35880714654922485,
-0.0741224661469459... |
javascript/reference/global_objects/set/values/index.md | JavaScript - Global Objects - Set - values - Syntax - Parameters:
None. | [
-0.38145461678504944,
0.14025942981243134,
-1.654941201210022,
-0.460561066865921,
-0.6762514710426331,
-1.5312563180923462,
0.8711695671081543,
1.269415259361267,
-0.25885507464408875,
-0.9557372331619263,
-0.7546789646148682,
-0.3370679020881653,
0.06449738144874573,
0.05835150554776192,... |
javascript/reference/global_objects/set/values/index.md | JavaScript - Global Objects - Set - values - Syntax - Return value:
A new iterable iterator object. | [
-0.420566588640213,
-0.06337317824363708,
-1.0984773635864258,
0.11636854708194733,
-0.4950721859931946,
-1.8023784160614014,
-0.24721215665340424,
1.5360828638076782,
-0.21184922754764557,
-0.11796130239963531,
-0.5918025374412537,
0.5744401812553406,
-0.03653356432914734,
0.8907407522201... |
javascript/reference/global_objects/set/values/index.md | JavaScript - Global Objects - Set - values - Examples - Using values():
Example:
const mySet = new Set();
mySet.add("foo");
mySet.add("bar");
mySet.add("baz");
const setIter = mySet.values();
console.log(setIter.next().value); // "foo"
console.log(setIter.next().value); // "bar"
console.log(setIter.next().value); /... | [
-0.4293184280395508,
-0.20109644532203674,
-1.769455075263977,
1.2162208557128906,
-0.6634576320648193,
-1.7809995412826538,
-0.29371097683906555,
0.588977038860321,
0.3038700222969055,
-0.26953431963920593,
-0.5226112008094788,
0.6416043043136597,
0.19716379046440125,
-0.20722393691539764... |
javascript/reference/global_objects/set/delete/index.md | JavaScript - Global Objects - Set - delete:
The `delete()` method of `Set` instances removes the specified value from this set, if it is in the set.
Example:
const set = new Set();
set.add({ x: 10, y: 20 }).add({ x: 20, y: 30 });
// Delete any point with `x > 10`.
set.forEach((point) => {
if (point.x > 10) {
... | [
-0.480250746011734,
-0.5647776126861572,
-1.3789546489715576,
0.231201633810997,
0.0049840789288282394,
-1.9887769222259521,
0.439148873090744,
0.313436895608902,
0.25582823157310486,
-0.0689721554517746,
-0.705474317073822,
0.46560466289520264,
-0.3196227550506592,
0.34819725155830383,
... |
javascript/reference/global_objects/set/delete/index.md | JavaScript - Global Objects - Set - delete - Syntax:
Example:
setInstance.delete(value) | [
-0.5919153690338135,
0.15103116631507874,
-0.7009679079055786,
0.0751759260892868,
-0.7600935697555542,
-1.4836064577102661,
0.6040984988212585,
1.0326765775680542,
0.516323447227478,
-0.7320334911346436,
-0.10790613293647766,
0.48141899704933167,
0.3015581965446472,
0.3933696150779724,
... |
javascript/reference/global_objects/set/delete/index.md | JavaScript - Global Objects - Set - delete - Syntax - Parameters:
- `value`: The value to remove from the `Set` object. Objects are compared by reference, not by value. | [
-0.19610559940338135,
-0.1271733194589615,
-1.1308916807174683,
0.10762639343738556,
-0.15801075100898743,
-1.9675192832946777,
0.7540335655212402,
0.8595672845840454,
0.6121479272842407,
-0.6832353472709656,
-0.7559096217155457,
0.6618865728378296,
-0.5322439670562744,
0.3750125765800476,... |
javascript/reference/global_objects/set/delete/index.md | JavaScript - Global Objects - Set - delete - Syntax - Return value:
`true` if a value in the `Set` object has been removed successfully. `false` if the value is not found in the `Set`. | [
-1.0273433923721313,
-0.04460294544696808,
-1.1185601949691772,
0.12170059978961945,
-0.39285317063331604,
-2.4652435779571533,
0.763595700263977,
0.9224717617034912,
-0.41889259219169617,
-0.06161053106188774,
-0.4333978295326233,
0.31944528222084045,
-0.1723548024892807,
0.64505076408386... |
javascript/reference/global_objects/set/delete/index.md | JavaScript - Global Objects - Set - delete - Examples - Using delete():
Example:
const mySet = new Set();
mySet.add("foo");
console.log(mySet.delete("bar")); // false; no "bar" element found to be deleted.
console.log(mySet.delete("foo")); // true; successfully removed.
console.log(mySet.has("foo")); // false; the ... | [
-0.7326884865760803,
-0.007667587138712406,
-1.2529937028884888,
0.6569806933403015,
-0.3461981415748596,
-2.3283724784851074,
0.3702754080295563,
0.534376859664917,
0.11539414525032043,
0.24867214262485504,
-0.39748817682266235,
0.31594589352607727,
-0.34596526622772217,
0.190011844038963... |
javascript/reference/global_objects/set/delete/index.md | JavaScript - Global Objects - Set - delete - Examples - Deleting an object from a set:
Because objects are compared by reference, you have to delete them by checking individual properties if you don't have a reference to the original object.
Example:
const setObj = new Set(); // Create a new set.
setObj.add({ x: 10... | [
-0.6940677165985107,
0.0972658097743988,
-1.0751279592514038,
0.37617915868759155,
0.05985976755619049,
-1.8054609298706055,
0.5956901907920837,
0.08588764071464539,
0.171872079372406,
-0.2533043324947357,
-1.0035364627838135,
0.34852954745292664,
-0.7026448249816895,
0.2589764893054962,
... |
javascript/reference/global_objects/set/entries/index.md | JavaScript - Global Objects - Set - entries:
The `entries()` method of `Set` instances returns a new set iterator object that contains an array of `[value, value]` for each element in this set, in insertion order. For `Set` objects there is no `key` like in `Map` objects. However, to keep the API similar to the `Map` ... | [
-0.11220481246709824,
-1.0285342931747437,
-1.5552561283111572,
1.0399103164672852,
0.05394842103123665,
-1.558536410331726,
-0.3686857521533966,
0.2527783513069153,
-0.32162103056907654,
0.393074095249176,
0.1499660164117813,
0.3303822875022888,
0.7204569578170776,
0.6038895845413208,
-... |
javascript/reference/global_objects/set/entries/index.md | JavaScript - Global Objects - Set - entries - Syntax:
Example:
entries() | [
0.4573898911476135,
-0.5866839289665222,
-1.421784520149231,
0.6727145314216614,
-0.8299959301948547,
-2.185041666030884,
0.3825010359287262,
0.959680438041687,
-0.11298905313014984,
-0.6701377034187317,
-0.2799642086029053,
0.4173215925693512,
0.10505975782871246,
0.15309104323387146,
0... |
javascript/reference/global_objects/set/entries/index.md | JavaScript - Global Objects - Set - entries - Syntax - Parameters:
None. | [
0.09147966653108597,
-0.0164058655500412,
-1.505722165107727,
-0.22215259075164795,
-0.510114848613739,
-1.47231125831604,
0.657432496547699,
1.1831002235412598,
-0.2894953489303589,
-0.7355632781982422,
-0.7708650231361389,
-0.5054039359092712,
0.04172821715474129,
0.4305077791213989,
0... |
javascript/reference/global_objects/set/entries/index.md | JavaScript - Global Objects - Set - entries - Syntax - Return value:
A new iterable iterator object. | [
-0.13727238774299622,
-0.30896180868148804,
-1.1086812019348145,
0.16033150255680084,
-0.4526764452457428,
-1.8540698289871216,
-0.17145602405071259,
1.378233551979065,
-0.10676994919776917,
0.04129282757639885,
-0.6486412286758423,
0.3157669007778168,
-0.0971497967839241,
0.96082454919815... |
javascript/reference/global_objects/set/entries/index.md | JavaScript - Global Objects - Set - entries - Examples - Using entries():
Example:
const mySet = new Set();
mySet.add("foobar");
mySet.add(1);
mySet.add("baz");
const setIter = mySet.entries();
console.log(setIter.next().value); // ["foobar", "foobar"]
console.log(setIter.next().value); // [1, 1]
console.log(setIte... | [
-0.14772072434425354,
-0.4716545641422272,
-1.9806662797927856,
1.2549022436141968,
-0.4983252286911011,
-1.7754789590835571,
-0.46726810932159424,
0.5058329701423645,
0.14826229214668274,
-0.09978275746107101,
-0.9045310616493225,
0.43258005380630493,
0.25898998975753784,
-0.0900756716728... |
javascript/reference/global_objects/float16array/index.md | JavaScript - Global Objects - Float16Array:
The `Float16Array` typed array represents an array of 16-bit floating point numbers in the platform byte order. If control over byte order is needed, use `DataView` instead. The contents are initialized to `0` unless initialization data is explicitly provided. Once establish... | [
-0.029672887176275253,
-0.926237940788269,
-1.2393178939819336,
0.09305216372013092,
0.5497148633003235,
-0.7444524168968201,
0.8156629204750061,
1.3203195333480835,
0.4429117739200592,
0.1861828863620758,
-0.13917452096939087,
0.35164785385131836,
0.11185744404792786,
0.1295611560344696,
... |
javascript/reference/global_objects/float16array/index.md | JavaScript - Global Objects - Float16Array - Constructor:
- `Float16Array()`: Creates a new `Float16Array` object. | [
-0.7016810774803162,
-0.21618393063545227,
-0.9082498550415039,
-0.4038356840610504,
-0.23651719093322754,
-0.8589633703231812,
-0.22354643046855927,
1.3133139610290527,
0.11735356599092484,
-0.37716707587242126,
0.1432114839553833,
0.43197786808013916,
-0.5590289235115051,
-0.103128969669... |
javascript/reference/global_objects/float16array/index.md | JavaScript - Global Objects - Float16Array - Static properties:
Also inherits static properties from its parent `TypedArray`.
- `Float16Array.BYTES_PER_ELEMENT`: Returns a number value of the element size. `2` in the case of `Float16Array`. | [
-0.6852803826332092,
-0.00033236859599128366,
-1.0256317853927612,
-0.4092945456504822,
-0.07971344143152237,
-1.4428609609603882,
0.7364281415939331,
1.308670997619629,
-0.10880892723798752,
-0.375397264957428,
-0.1595735102891922,
1.1477620601654053,
-0.8634568452835083,
-0.0679315105080... |
javascript/reference/global_objects/float16array/index.md | JavaScript - Global Objects - Float16Array - Static methods:
Inherits static methods from its parent `TypedArray`. | [
-0.04059786722064018,
-0.060168005526065826,
-0.9928186535835266,
-0.538708508014679,
0.011611979454755783,
-1.2273361682891846,
0.8049236536026001,
1.951789379119873,
-0.2825390696525574,
-0.378759503364563,
-0.38610216975212097,
0.07072698324918747,
-0.8015807867050171,
-0.20632782578468... |
javascript/reference/global_objects/float16array/index.md | JavaScript - Global Objects - Float16Array - Instance properties:
Also inherits instance properties from its parent `TypedArray`.
These properties are defined on `Float16Array.prototype` and shared by all `Float16Array` instances.
- `Float16Array.prototype.BYTES_PER_ELEMENT`: Returns a number value of the element si... | [
0.15377028286457062,
-0.3383936882019043,
-0.5386714935302734,
0.23945285379886627,
0.4857504963874817,
-0.35007089376449585,
0.5702393054962158,
0.8697826862335205,
0.35439661145210266,
-0.3288910388946533,
-0.2586609721183777,
0.5978487133979797,
-0.2222181111574173,
-0.04047950729727745... |
javascript/reference/global_objects/float16array/index.md | JavaScript - Global Objects - Float16Array - Instance methods:
Inherits instance methods from its parent `TypedArray`. | [
0.3392050266265869,
-0.26250627636909485,
-0.6470028162002563,
-0.31796589493751526,
-0.21441343426704407,
-0.9589774012565613,
0.8167015910148621,
1.3522605895996094,
-0.3414408266544342,
-0.7623139023780823,
-0.07088819146156311,
0.41003525257110596,
-0.7115841507911682,
0.14534921944141... |
javascript/reference/global_objects/float16array/index.md | JavaScript - Global Objects - Float16Array - Examples - Different ways to create a Float16Array:
Example:
// From a length
const float16 = new Float16Array(2);
float16[0] = 42;
console.log(float16[0]); // 42
console.log(float16.length); // 2
console.log(float16.BYTES_PER_ELEMENT); // 2
// From an array
const x = new... | [
0.17036233842372894,
-0.33480337262153625,
-0.8126821517944336,
-0.23654772341251373,
0.48901522159576416,
-0.4504901170730591,
-0.36090266704559326,
0.8625363111495972,
0.3266782760620117,
-0.24596695601940155,
0.43770748376846313,
0.7667617201805115,
-0.819286584854126,
-0.13793827593326... |
javascript/reference/global_objects/float16array/float16array/index.md | JavaScript - Global Objects - Float16Array:
The `Float16Array()` constructor creates `Float16Array` objects. The contents are initialized to `0` unless initialization data is explicitly provided. | [
-0.21497254073619843,
-0.28587043285369873,
-0.6349179148674011,
0.06884964555501938,
-0.16628941893577576,
-0.9561309218406677,
0.2072078287601471,
1.2859655618667603,
-0.27484580874443054,
-0.12280520796775818,
-0.04070006310939789,
0.07030204683542252,
-0.7330664396286011,
-0.4224130213... |
javascript/reference/global_objects/float16array/float16array/index.md | JavaScript - Global Objects - Float16Array - Syntax:
Example:
new Float16Array()
new Float16Array(length)
new Float16Array(typedArray)
new Float16Array(object)
new Float16Array(buffer)
new Float16Array(buffer, byteOffset)
new Float16Array(buffer, byteOffset, length)
Note: `Float16Array()` can only be constructed wi... | [
-0.11753743886947632,
-0.24387520551681519,
-0.9772701859474182,
-0.9372145533561707,
-0.00092770264018327,
-0.9049566984176636,
-0.38219988346099854,
1.39176607131958,
0.5474205017089844,
-0.44604119658470154,
0.42252108454704285,
0.6305541396141052,
-0.24530494213104248,
0.03834457695484... |
javascript/reference/global_objects/float16array/float16array/index.md | JavaScript - Global Objects - Float16Array - Syntax - Parameters:
See `TypedArray`. | [
0.7180666923522949,
-0.1754215508699417,
-0.8648841977119446,
-0.596071183681488,
-0.38040757179260254,
-0.6533507704734802,
0.4332718253135681,
1.430942177772522,
0.11434116214513779,
-0.13434849679470062,
0.15036852657794952,
0.6117165088653564,
-0.0007252186187542975,
0.1339274346828460... |
javascript/reference/global_objects/float16array/float16array/index.md | JavaScript - Global Objects - Float16Array - Syntax - Exceptions:
See `TypedArray`. | [
0.31440234184265137,
-0.4538240432739258,
-0.605063796043396,
-0.28838497400283813,
-0.49725738167762756,
-1.0135809183120728,
0.06517418473958969,
1.6083539724349976,
-0.12430655211210251,
-0.326002299785614,
0.41565924882888794,
0.2912072241306305,
-0.3410155177116394,
0.0916400849819183... |
javascript/reference/global_objects/float16array/float16array/index.md | JavaScript - Global Objects - Float16Array - Examples - Different ways to create a Float16Array:
Example:
// From a length
const float16 = new Float16Array(2);
float16[0] = 42;
console.log(float16[0]); // 42
console.log(float16.length); // 2
console.log(float16.BYTES_PER_ELEMENT); // 2
// From an array
const x = new... | [
0.17036233842372894,
-0.33480337262153625,
-0.8126821517944336,
-0.23654772341251373,
0.48901522159576416,
-0.4504901170730591,
-0.36090266704559326,
0.8625363111495972,
0.3266782760620117,
-0.24596695601940155,
0.43770748376846313,
0.7667617201805115,
-0.819286584854126,
-0.13793827593326... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval:
Warning: The argument passed to this function is dynamically parsed and executed as JavaScript. APIs like this are known as injection sinks, and are potentially a vector for cross-site-scripting (XSS) attacks. You can mitigate this risk by always passing `TrustedScript` objects inst... | [
-1.2011439800262451,
-0.36246007680892944,
-0.5041891932487488,
0.8780495524406433,
0.26258257031440735,
-1.8273885250091553,
0.5696855187416077,
0.37256428599357605,
-0.6303420662879944,
0.5413309335708618,
-0.08861443400382996,
0.6474568843841553,
0.02104984223842621,
-0.0169702935963869... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Syntax:
Example:
eval(script) | [
-0.4212965667247772,
0.03020680509507656,
-0.20882724225521088,
-0.35196012258529663,
-0.4919860363006592,
-1.9211066961288452,
1.084415316581726,
1.0287792682647705,
-0.4135379493236542,
-0.46187394857406616,
-0.15370133519172668,
0.6649479866027832,
-0.3802947402000427,
0.024575943127274... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Syntax - Parameters:
- `script`: A `TrustedScript` instance or string representing a JavaScript expression, statement, or sequence of statements. The expression can include variables and properties of existing objects. It will be parsed as a script, so `import` declarations (which ... | [
-0.4147905707359314,
-0.490469753742218,
-0.9160968661308289,
0.5969334840774536,
0.2186550498008728,
-1.9015480279922485,
0.2995283901691437,
0.44608211517333984,
-0.1508949100971222,
-0.1614675372838974,
-0.3887178301811218,
0.39212676882743835,
-0.5762549638748169,
0.06960202753543854,
... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Syntax - Return value:
The completion value of evaluating the given code. If the completion value is empty, `undefined` is returned. If `script` is not a `TrustedScript` or string primitive, `eval()` returns the argument unchanged. | [
-1.3641456365585327,
0.12952183187007904,
0.1671389788389206,
-0.354977548122406,
-0.20026317238807678,
-1.890116810798645,
1.4482245445251465,
0.6881097555160522,
-0.5274494886398315,
0.21876463294029236,
-0.37215718626976013,
0.302427738904953,
-0.40433722734451294,
0.6514328122138977,
... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Syntax - Exceptions:
- `SyntaxError`: The `script` parameter cannot be parsed as a script.
- `TypeError`: `script` is a string when Trusted Types are enforced by a CSP and no default policy is defined.
The method also throws any exception that occurs during evaluation of the code. | [
-1.0133754014968872,
-0.1336681991815567,
-0.44396600127220154,
0.45536884665489197,
-0.4078778624534607,
-1.8547817468643188,
-0.014281738549470901,
0.739237904548645,
-0.44724950194358826,
-0.13008788228034973,
-0.3430604040622711,
0.3031931221485138,
0.07622066140174866,
-0.138411834836... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Description:
`eval()` is a function property of the global object.
The argument of the `eval()` function is a string. It will evaluate the source string as a script body, which means both statements and expressions are allowed. It returns the completion value of the code. For expr... | [
0.5095426440238953,
0.3720053732395172,
-0.026458773761987686,
0.6172587871551514,
0.8543640375137329,
-1.194935917854309,
-0.2171701043844223,
-0.24122639000415802,
-0.3793121874332428,
-0.283723384141922,
-0.35396847128868103,
-0.20128805935382843,
-0.34386715292930603,
0.667248904705047... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Description - Direct and indirect eval:
There are two modes of `eval()` calls: direct eval and indirect eval. Direct eval, as the name implies, refers to directly calling the global `eval` function with `eval(...)`. Everything else, including invoking it via an aliased variable, vi... | [
-0.3057515323162079,
0.09799165278673172,
0.019619854167103767,
0.2998213768005371,
0.5661054253578186,
-1.2788292169570923,
0.19416987895965576,
0.2497289776802063,
-0.3156045973300934,
0.4998932480812073,
-0.2598494291305542,
0.19681046903133392,
-0.2665470540523529,
-0.1054106280207634,... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Description - Never use direct eval()!:
Using direct `eval()` suffers from multiple problems:
- `eval()` executes the code it's passed with the privileges of the caller. If you run `eval()` with a string that could be affected by a malicious party, you may end up running malicious... | [
-0.48499882221221924,
0.680473268032074,
-0.8232977986335754,
0.5137450098991394,
-0.7061967253684998,
-0.4890764057636261,
0.4200234115123749,
-0.23080375790596008,
-0.13512112200260162,
0.715451717376709,
-0.2255580872297287,
0.024009650573134422,
-0.12081800401210785,
-0.404484033584594... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Description - Never use direct eval()! - Using indirect eval():
Consider this code:
Example:
function looseJsonParse(obj) {
return eval(`(${obj})`);
}
console.log(looseJsonParse("{ a: 4 - 1, b: function () {}, c: new Map() }"));
Simply using indirect eval and forcing strict mo... | [
-0.27580374479293823,
0.6232820153236389,
-0.27731800079345703,
0.5812129378318787,
0.919996976852417,
-0.9289546608924866,
0.1046694815158844,
0.13516393303871155,
-0.4310365617275238,
0.5166827440261841,
-0.30501270294189453,
0.05996144935488701,
-0.27460604906082153,
0.2367473691701889,... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Description - Never use direct eval()! - Using the Function() constructor:
The `Function()` constructor is very similar to the indirect eval example above: it also evaluates the JavaScript source passed to it in the global scope without reading or mutating any local bindings, and t... | [
-0.11612149327993393,
0.3051208555698395,
-0.39892563223838806,
0.969155490398407,
0.9956809282302856,
-1.4209462404251099,
0.0897952988743782,
0.35977721214294434,
-0.6070475578308105,
0.26347115635871887,
-0.27741608023643494,
0.15602299571037292,
-0.0307944193482399,
0.14332588016986847... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Description - Never use direct eval()! - Using bracket accessors:
You should not use `eval()` to access properties dynamically. Consider the following example where the property of the object to be accessed is not known until the code is executed. This can be done with `eval()`:
E... | [
0.11282221227884293,
0.24710407853126526,
-0.549467146396637,
0.5767371654510498,
0.5395790338516235,
-1.197737693786621,
0.5382706522941589,
0.3775595426559448,
-0.19164139032363892,
0.12538163363933563,
-0.9200939536094666,
0.9091883897781372,
-0.8526537418365479,
-0.10044240951538086,
... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Description - Never use direct eval()! - Using callbacks:
JavaScript has first-class functions, which means you can pass functions as arguments to other APIs, store them in variables and objects' properties, and so on. Many DOM APIs are designed with this in mind, so you can (and s... | [
-0.8653375506401062,
-0.5008164048194885,
-0.527496874332428,
1.6456596851348877,
-0.3630024492740631,
-1.2591784000396729,
0.4839918613433838,
-0.4563870131969452,
-0.8302218914031982,
0.2196531742811203,
-0.2657865881919861,
0.7215617895126343,
0.10343404859304428,
0.1733059287071228,
... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Description - Never use direct eval()! - Using JSON:
If the string you're calling `eval()` on contains data (for example, an array: `"[1, 2, 3]"`), as opposed to code, you should consider switching to `JSON`, which allows the string to use a subset of JavaScript syntax to represent... | [
-0.9347407221794128,
-0.12220583111047745,
-0.5941618084907532,
0.31047195196151733,
0.08920199424028397,
-1.6930620670318604,
0.9417659640312195,
0.1452954113483429,
-0.6157988905906677,
0.2560170590877533,
-0.14435286819934845,
1.25126051902771,
-0.26277726888656616,
-0.6272834539413452,... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Description - Security considerations:
The method can be used to execute arbitrary input with the privileges of the caller. If the input is a potentially unsafe string provided by a user, this is a possible vector for Cross-site-scripting (XSS) attacks.
For example, the following ... | [
-0.7734116315841675,
-0.05954902991652489,
-0.8526761531829834,
0.9268946647644043,
-0.1633475422859192,
-0.3316514790058136,
1.2261656522750854,
0.5720974206924438,
-0.7504845857620239,
0.7654294371604919,
-0.058709993958473206,
0.5530446767807007,
-0.0566728375852108,
-1.0246617794036865... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Examples:
Note that the first example shows how to use the method with trusted types. The other examples omit this step for brevity. | [
-0.6372923851013184,
0.4886661767959595,
-0.46114054322242737,
0.3488553762435913,
-0.6402827501296997,
-0.880966067314148,
1.640277624130249,
0.33370572328567505,
-0.6958408951759338,
0.327982634305954,
-0.06515678018331528,
0.34592971205711365,
0.16242319345474243,
-0.25320640206336975,
... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Examples - Using TrustedScript:
To mitigate the risk of XSS, we should always assign `TrustedScript` instances to the `script` parameter. We also need to do this if we're enforcing trusted types for other reasons and we want to allow some script sources that have been permitted (by... | [
-0.5481100678443909,
0.16461032629013062,
-0.17541323602199554,
1.1312757730484009,
0.22907310724258423,
-1.2285178899765015,
0.5849252343177795,
0.43051305413246155,
-0.15138380229473114,
0.5093477368354797,
0.23497188091278076,
0.32539334893226624,
-0.2594403028488159,
-0.744647145271301... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Examples - Using eval():
In the following code, both of the statements containing `eval()` return 42. The first evaluates the string `"x + y + 1"`; the second evaluates the string `"42"`.
Example:
const x = 2;
const y = 39;
const z = "42";
eval("x + y + 1"); // 42
eval(z); // 42 | [
-0.7232008576393127,
0.3061721920967102,
-0.37906235456466675,
0.3560081720352173,
-0.025963515043258667,
-0.5193166136741638,
0.7348700761795044,
0.26026636362075806,
0.015560133382678032,
-0.1906643509864807,
-0.09496884793043137,
0.3214361369609833,
-0.01613542251288891,
0.2519842386245... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Examples - eval() returns the completion value of statements:
`eval()` returns the completion value of statements. For `if`, it would be the last expression or statement evaluated.
Example:
const str = "if (a) { 1 + 1 } else { 1 + 2 }";
let a = true;
let b = eval(str);
console.l... | [
-0.5777783989906311,
-0.1556740403175354,
-0.31718555092811584,
0.3363831639289856,
0.027923066169023514,
-1.4095090627670288,
1.0312541723251343,
0.1354062259197235,
-0.14334899187088013,
-0.035392213612794876,
0.39145442843437195,
0.3270714581012726,
-0.1587299406528473,
0.44208246469497... |
javascript/reference/global_objects/eval/index.md | JavaScript - Global Objects - eval - Examples - eval() as a string defining function requires "(" and ")" as prefix and suffix:
Example:
// This is a function declaration
const fctStr1 = "function a() {}";
// This is a function expression
const fctStr2 = "(function b() {})";
const fct1 = eval(fctStr1); // return unde... | [
-1.0096558332443237,
-0.04753861576318741,
-0.0836106613278389,
0.23718485236167908,
0.4694966673851013,
-1.1936935186386108,
0.06170265004038811,
0.3409334421157837,
-0.5331819653511047,
0.04121137037873268,
-0.3864305913448334,
0.03388337790966034,
-0.1445664018392563,
0.3007614314556122... |
javascript/reference/global_objects/evalerror/index.md | JavaScript - Global Objects - EvalError:
The `EvalError` object indicates an error regarding the global `eval()` function. This exception is not thrown by JavaScript anymore, however the `EvalError` object remains for compatibility.
`EvalError` is a `serializable object`, so it can be cloned with `structuredClone()` ... | [
-0.6737114787101746,
-0.300015926361084,
-0.27491387724876404,
0.5923181772232056,
-0.057377561926841736,
-1.214787244796753,
-0.3915105164051056,
0.7796229124069214,
-0.6330689787864685,
-0.837593674659729,
0.1708669811487198,
0.36898669600486755,
0.0032924676779657602,
0.4628580808639526... |
javascript/reference/global_objects/evalerror/index.md | JavaScript - Global Objects - EvalError - Constructor:
- `EvalError()`: Creates a new `EvalError` object. | [
-0.37644001841545105,
-0.13635170459747314,
-0.2798674404621124,
0.06808141618967056,
0.0028487900272011757,
-1.476873517036438,
-0.21496330201625824,
1.262866735458374,
-0.633742094039917,
-0.4125828742980957,
-0.2927800714969635,
-0.3202793598175049,
0.03273726627230644,
0.21646995842456... |
javascript/reference/global_objects/evalerror/index.md | JavaScript - Global Objects - EvalError - Instance properties:
Also inherits instance properties from its parent `Error`.
These properties are defined on `EvalError.prototype` and shared by all `EvalError` instances.
- `EvalError.prototype.constructor`: The constructor function that created the instance object. For ... | [
0.09259864687919617,
-0.5616578459739685,
-0.3618800938129425,
0.45951324701309204,
-0.1582765281200409,
-1.5114169120788574,
0.22986990213394165,
1.3283474445343018,
0.07161513715982437,
-0.5244868993759155,
-0.7872335314750671,
0.24245582520961761,
-0.9938759207725525,
0.3462028503417969... |
javascript/reference/global_objects/evalerror/index.md | JavaScript - Global Objects - EvalError - Instance methods:
Inherits instance methods from its parent `Error`. | [
-0.068675696849823,
-0.5261318683624268,
-0.4277488887310028,
-0.009309905581176281,
-0.27347663044929504,
-1.7693785429000854,
1.0119673013687134,
1.1638725996017456,
-0.6883299946784973,
-1.1171151399612427,
-0.5561010241508484,
-0.060186807066202164,
-0.5511277914047241,
0.7706303000450... |
javascript/reference/global_objects/evalerror/index.md | JavaScript - Global Objects - EvalError - Examples - Creating an EvalError:
Example:
try {
throw new EvalError("Hello");
} catch (e) {
console.log(e instanceof EvalError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "EvalError"
console.log(e.stack); // Stack of the error
} | [
0.130527064204216,
-0.16713710129261017,
-0.2949783504009247,
1.2999869585037231,
0.09193043410778046,
-1.1175105571746826,
-0.1949097216129303,
0.6200025677680969,
-0.5246020555496216,
-0.561785101890564,
-0.05056541785597801,
-0.06207961216568947,
0.4418388903141022,
0.02487826719880104,... |
javascript/reference/global_objects/evalerror/evalerror/index.md | JavaScript - Global Objects - EvalError:
The `EvalError()` constructor creates `EvalError` objects. | [
-0.055506542325019836,
0.0762743428349495,
-0.3117622435092926,
0.25682494044303894,
-0.26383835077285767,
-1.6746429204940796,
-0.4300892651081085,
1.079918384552002,
-0.8297744393348694,
-0.25198057293891907,
-0.20259059965610504,
-0.15184977650642395,
-0.20557115972042084,
-0.0999474152... |
javascript/reference/global_objects/evalerror/evalerror/index.md | JavaScript - Global Objects - EvalError - Syntax:
Example:
new EvalError()
new EvalError(message)
new EvalError(message, options)
new EvalError(message, fileName)
new EvalError(message, fileName, lineNumber)
EvalError()
EvalError(message)
EvalError(message, options)
EvalError(message, fileName)
EvalError(message, fi... | [
-0.1666414737701416,
-0.6098897457122803,
-0.18021073937416077,
-0.03429550305008888,
-0.11087539792060852,
-1.5239721536636353,
-0.3385246694087982,
1.2245619297027588,
-0.24011413753032684,
-0.6662442088127136,
0.1350390911102295,
-0.17361392080783844,
0.19806358218193054,
0.568116724491... |
javascript/reference/global_objects/evalerror/evalerror/index.md | JavaScript - Global Objects - EvalError - Syntax - Parameters:
- `message` (optional): Human-readable description of the error.
- `options` (optional): An object that has the following properties:
- `cause` (optional): A property indicating the specific cause of the error. When catching and re-throwing an error with... | [
-0.24893051385879517,
-0.9172141551971436,
-0.7349453568458557,
-0.29957351088523865,
0.19887635111808777,
-1.6161019802093506,
0.3325859308242798,
0.7808988690376282,
-0.04946793615818024,
-0.369278222322464,
-1.0330970287322998,
0.07434095442295074,
-0.17022773623466492,
0.67653483152389... |
javascript/reference/global_objects/evalerror/evalerror/index.md | JavaScript - Global Objects - EvalError - Examples:
`EvalError` is not used in the current ECMAScript specification and will thus not be thrown by the runtime. However, the object itself remains for backwards compatibility with earlier versions of the specification. | [
-0.5559672117233276,
0.3866252899169922,
-0.9359140992164612,
0.5296603441238403,
-0.09212400019168854,
-1.361047625541687,
0.5403851270675659,
0.8851951360702515,
-0.3491581380367279,
-0.14193066954612732,
0.15957316756248474,
0.7513586282730103,
0.2343982607126236,
0.24441620707511902,
... |
javascript/reference/global_objects/evalerror/evalerror/index.md | JavaScript - Global Objects - EvalError - Examples - Creating an EvalError:
Example:
try {
throw new EvalError("Hello");
} catch (e) {
console.log(e instanceof EvalError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "EvalError"
console.log(e.stack); // Stack of the error
} | [
0.130527064204216,
-0.16713710129261017,
-0.2949783504009247,
1.2999869585037231,
0.09193043410778046,
-1.1175105571746826,
-0.1949097216129303,
0.6200025677680969,
-0.5246020555496216,
-0.561785101890564,
-0.05056541785597801,
-0.06207961216568947,
0.4418388903141022,
0.02487826719880104,... |
javascript/reference/global_objects/asyncfunction/index.md | JavaScript - Global Objects - AsyncFunction:
The `AsyncFunction` object provides methods for async functions. In JavaScript, every async function is actually an `AsyncFunction` object.
Note that `AsyncFunction` is not a global object. It can be obtained with the following code:
Example:
const AsyncFunction = async ... | [
-0.866306483745575,
-0.2880357801914215,
-1.1816869974136353,
0.4317375421524048,
-0.5946089029312134,
-1.6344268321990967,
0.31838053464889526,
0.6782574653625488,
-0.03898802772164345,
0.2511831223964691,
-0.7440090775489807,
-0.7467636466026306,
-0.17862918972969055,
0.5271945595741272,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.