file
stringlengths
16
94
text
stringlengths
32
24.4k
vector
list
api/web_storage_api/using_the_web_storage_api/index.md
API - Web Storage API - Using the Web Storage API - Example - Setting values in storage: `Storage.setItem()` is used both to create new data items, and (if the data item already exists) update existing values. This takes two arguments — the key of the data item to create/modify, and the value to store in it. Example:...
[ 0.7341688275337219, -0.08671261370182037, -0.2047877311706543, 0.550704836845398, 0.25768187642097473, -1.5888928174972534, -0.3695395886898041, 1.1481660604476929, 0.25911733508110046, -0.5670338273048401, 0.04831548035144806, 0.997077226638794, 0.2843577563762665, 0.16612455248832703, ...
api/web_storage_api/using_the_web_storage_api/index.md
API - Web Storage API - Using the Web Storage API - Example - Responding to storage changes with the StorageEvent: The `storage` event is fired whenever a change is made to the `Storage` object of another document that shares the same storage space. This won't work on the same page that is making the changes — it is r...
[ 0.7855977416038513, 0.08882270753383636, -0.16500800848007202, 0.1141398549079895, 0.24754726886749268, -1.5596208572387695, 0.5359101891517639, 1.8273026943206787, -0.5471662282943726, 0.10623251646757126, 0.5379502773284912, 1.204634428024292, -0.5064020156860352, 0.6750871539115906, -...
api/web_storage_api/using_the_web_storage_api/index.md
API - Web Storage API - Using the Web Storage API - Example - Deleting data records: Web Storage also provides a couple of simple methods to remove data. We don't use these in our demo, but they are very simple to add to your project: - `Storage.removeItem()` takes a single argument — the key of the data item you wan...
[ 0.5476844906806946, -0.5391343832015991, -0.4456627368927002, 0.7221146821975708, -0.21205344796180725, -2.06965708732605, -0.2882526218891144, 1.41828453540802, -0.06287690252065659, 0.48475584387779236, -0.04835887253284454, 0.6985923051834106, 0.26909175515174866, 0.2992478609085083, ...
api/fetchevent/preloadresponse/index.md
API - FetchEvent - preloadResponse: Note: This feature is available in Web Workers. The `preloadResponse` read-only property of the `FetchEvent` interface returns a `Promise` that resolves to the navigation preload `Response` if navigation preload was triggered, or `undefined` otherwise. Navigation preload is trigge...
[ 0.37037035822868347, -0.6483712792396545, -0.41974958777427673, 0.06885899603366852, 0.2659757733345032, -0.8298054933547974, 0.20254702866077423, 1.4755589962005615, -0.10730946809053421, 0.3900846838951111, 0.13382376730442047, 0.7830454111099243, -0.12888872623443604, 0.3863735496997833...
api/fetchevent/preloadresponse/index.md
API - FetchEvent - preloadResponse - Value: A `Promise` that resolves to a `Response` or otherwise to `undefined`.
[ 0.01575879193842411, 0.18712610006332397, 0.35478782653808594, 0.13117969036102295, -0.055013205856084824, -0.9475802779197693, 1.0127696990966797, 0.3859339654445648, 0.0423673540353775, 0.07240696251392365, -0.6906495094299316, 0.6637510061264038, -0.6524533629417419, 0.536237895488739, ...
api/fetchevent/preloadresponse/index.md
API - FetchEvent - preloadResponse - Examples: This code snippet is from Speed up Service Worker with Navigation Preloads. The `onfetch` event handler listens for the `fetch` event. When fired, the handler calls `FetchEvent.respondWith()` to pass a promise back to the controlled page. This promise will resolve with t...
[ 0.010055841878056526, -0.23629829287528992, 0.18116624653339386, -0.01351497694849968, 0.449171245098114, -0.7070760130882263, 0.014479726552963257, 0.9536977410316467, 0.029180794954299927, 0.22538073360919952, -0.5644588470458984, 0.7862197756767273, -0.2922838032245636, 0.38751283288002...
api/request/destination/index.md
API - Request - destination: Note: This feature is available in Web Workers. The `destination` read-only property of the `Request` interface returns a string describing the type of content being requested. The string must be one of the `audio`, `audioworklet`, `document`, `embed`, `fencedframe`, `font`, `frame`, `if...
[ -0.3052321970462799, -0.5276393294334412, -0.4871219992637634, 0.6380502581596375, 0.39770981669425964, -0.298685222864151, 0.6344712972640991, 0.6779177784919739, -0.7088562846183777, 0.4601718783378601, -0.17302456498146057, 0.5775707364082336, 0.5273743867874146, -0.27708369493484497, ...
api/request/destination/index.md
API - Request - destination - Value: A string which indicates the type of content the request is asking for. This type is much broader than the usual document type values (such as `"document"` or `"manifest"`), and may include contextual cues such as `"image"` or `"worker"` or `"audioworklet"`. Possible values are: ...
[ 0.40281274914741516, -0.2972038984298706, -0.39779505133628845, 0.09869223833084106, 0.42007380723953247, -0.5118691921234131, 0.8618555068969727, 1.2426292896270752, -0.8049080967903137, 0.1446232944726944, 0.4142051339149475, 0.4585791826248169, 1.01936674118042, -0.20308566093444824, ...
api/request/destination/index.md
API - Request - destination - Examples: In the following snippet, we create a new request using the `Request()` constructor (for an image file in the same directory as the script), then save the request's destination: Example: const myRequest = new Request("flowers.jpg"); const myDestination = myRequest.destination;...
[ -0.23757734894752502, -0.4171774387359619, 0.21295879781246185, 0.2089780569076538, 0.33285561203956604, -1.122039556503296, -0.3034225404262543, 0.37756410241127014, 0.13995197415351868, -0.31467485427856445, -0.5432483553886414, 0.3079339563846588, 0.3225805461406708, 0.3210268020629883,...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API: The Web Speech API provides two distinct areas of functionality — speech recognition and speech synthesis (also known as text to speech, or TTS) — which open up interesting possibilities for accessibility and control. This article provides an introduction to both the ar...
[ 0.26018059253692627, 0.8103287816047668, -0.6228367686271667, 0.3196030855178833, 0.24933168292045593, -1.265397310256958, 0.2645615041255951, 1.1181037425994873, 0.3346998989582062, 1.0409936904907227, -0.18891192972660065, 0.6764589548110962, 0.285713255405426, 0.03006286919116974, -1....
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech recognition: Speech recognition involves receiving audio from a device's microphone (or from an audio track), which is then checked by a speech recognition service. When the service successfully recognizes a word or phrase, it returns a text string (or a list of...
[ 1.008096694946289, 0.9450631737709045, -0.4962652623653412, -0.06360261142253876, 0.17740511894226074, -0.9390006065368652, 0.40251487493515015, 0.9819799661636353, 0.07643407583236694, 0.17014077305793762, -0.10195264220237732, 0.7886085510253906, -0.13620248436927795, 0.3698039948940277,...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech recognition - Demo: To demonstrate how to use speech recognition, we've created a sample app called Speech color changer. After you press the Start recognition button, say an HTML color keyword. The app's background color will change to that color. To run the d...
[ -0.2045670747756958, 0.49563688039779663, -0.5034799575805664, -0.6490035653114319, -0.6925132274627686, -1.0472465753555298, -0.2812424600124359, 1.8482484817504883, 0.030637241899967194, 0.5692417025566101, -0.235626220703125, 0.4691392183303833, 0.6350898146629333, -0.3619028627872467, ...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech recognition - HTML and CSS: The HTML and CSS for the app are basic. There's a title, an instruction paragraph (`p`), a control `button`, and an output paragraph where we display diagnostic messages, including the words that our app recognized. Example: <h1>Spe...
[ 0.1826091855764389, 0.035871028900146484, -0.5067748427391052, -0.40355461835861206, -0.1597367227077484, -1.8149501085281372, 0.18346083164215088, 1.4172409772872925, -0.16170412302017212, 0.4811949133872986, -0.8027821183204651, 0.573131799697876, 0.7250790596008301, 0.38538339734077454,...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech recognition - JavaScript: Let's look at the JavaScript in a bit more detail.
[ -0.1468236744403839, 0.31430166959762573, -0.10623711347579956, -0.08361153304576874, -0.30944573879241943, -1.109437346458435, 0.582881510257721, 0.33044177293777466, 0.7260843515396118, -0.06973506510257721, -0.42951151728630066, 0.2758258879184723, 0.1368086338043213, 0.0187526792287826...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech recognition - JavaScript - Prefixed properties: Some browsers currently support speech recognition with prefixed properties. Therefore, at the start of our code, we include these lines to allow for both prefixed properties and unprefixed versions: Example: con...
[ 0.24277055263519287, 0.30102866888046265, -0.2898005545139313, 0.12401366233825684, -0.08121542632579803, -1.27540922164917, 0.13473889231681824, 1.1717784404754639, 0.4767897129058838, 0.49123263359069824, -0.03718281164765358, 0.758857250213623, 0.4752448797225952, 0.23313573002815247, ...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech recognition - JavaScript - Color list: The next part of our code defines a few sample colors that we print to the UI to give users an idea of what to say: Example: const colors = [ "aqua", "azure", "beige", "bisque", "black", "blue", "brown", "...
[ -0.17284679412841797, -0.37304359674453735, -0.3579886555671692, -0.5081498622894287, -0.37119439244270325, -0.8763218522071838, -0.1038576140999794, 1.138412594795227, 0.007218398153781891, 0.6453647017478943, -0.183163583278656, 0.4088834822177887, 0.5834124088287354, 0.07049566507339478...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech recognition - JavaScript - Creating a speech recognition instance: Next, we define a speech recognition instance to control the recognition in our app. We do this by using the `SpeechRecognition()` constructor. Example: const recognition = new SpeechRecognitio...
[ 0.8053374290466309, 0.40779194235801697, -0.3039277493953705, 0.5267450213432312, -0.06937903165817261, -1.179146409034729, -0.355261892080307, 0.6306791305541992, 0.7923787832260132, 0.4127400815486908, -0.3263753056526184, 0.841073751449585, 0.47810524702072144, 0.34655264019966125, 0....
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech recognition - JavaScript - Starting the speech recognition: After grabbing references to the output paragraph, the `<html>` element, the instruction paragraph, and the `<button>`, we implement an `onclick` handler. When a user presses the button, the speech reco...
[ -0.05174863710999489, 0.3718434274196625, -0.5105701684951782, -0.1725708395242691, -0.19968850910663605, -0.7249546051025391, 0.16515181958675385, 1.714298963546753, -0.2338750809431076, 0.32756781578063965, -0.3898754119873047, 0.47229665517807007, 0.3897053301334381, 0.12242798507213593...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech recognition - JavaScript - Receiving and handling results: Once the speech recognition has started, several event handlers become available, which you can use to retrieve results and other related information (see Events for `SpeechRecognition`). The most common...
[ 0.5773205161094666, 0.37281349301338196, -0.2849600315093994, -0.15553374588489532, -0.29483890533447266, -1.0281509160995483, 0.04486030340194702, 1.6780145168304443, -0.2629857063293457, 0.12416836619377136, 0.014551505446434021, 1.0638450384140015, 0.33492693305015564, 0.378693640232086...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech recognition - JavaScript - Handling errors and unrecognized speech: The last two handlers cover cases where the spoken term isn't recognized or an error occurs with the recognition. The `nomatch` event is supposed to handle the first case, although in most cases...
[ -0.02156156301498413, 0.22762860357761383, 0.09036673605442047, 0.06640917807817459, -0.26934778690338135, -1.208457589149475, -0.5196537971496582, 0.8139052391052246, 0.6420860886573792, 0.5461204051971436, -0.25931981205940247, 0.6215600967407227, 0.2626073360443115, 0.21315070986747742,...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - On-device speech recognition: Speech recognition is usually performed using an online service. This means that an audio recording is sent to a server for processing, and the results are then returned to the browser. This has a couple of problems: - Privacy: Many users...
[ 0.3186899721622467, 0.8109517097473145, -0.7327264547348022, 0.060535527765750885, 0.09431052207946777, -0.8083711862564087, 0.3047146797180176, 1.0138673782348633, 0.36561527848243713, 0.42965373396873474, 0.21063420176506042, 0.9223654270172119, 0.20178820192813873, -0.07130161672830582,...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - On-device speech recognition - Demo: To demonstrate on-device speech recognition, we've created a sample app called On-device speech color changer (run the demo live). This demo works in a very similar fashion to the online speech color changer demo discussed earlier,...
[ -0.09833894670009613, 0.10237400978803635, -0.718608558177948, -0.7236400246620178, -0.08724172413349152, -0.4816305339336395, 0.03486157953739166, 1.4671807289123535, 0.03545309603214264, 0.3840699791908264, 0.1590823382139206, 0.9731121063232422, 0.5474367737770081, -0.22119081020355225,...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - On-device speech recognition - Specifying on-device recognition: To specify that you want to use the browser's on-device processing, set the `SpeechRecognition.processLocally` property to `true` before starting any speech recognition (the default value is `false`): Ex...
[ 0.010531211271882057, 0.5972166657447815, -0.2823280692100525, 0.33692026138305664, -0.15156900882720947, -1.7003856897354126, -0.3155088722705841, 0.7838139533996582, 1.097633957862854, -0.5910118222236633, -0.5703047513961792, 0.05811648815870285, 0.4494963586330414, -0.23591451346874237...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - On-device speech recognition - Checking availability and installing language packs: For on-device speech recognition to work, the browser must have a language pack installed for the language you want to recognize. If you run the `start()` method after specifying `proce...
[ 0.4167478382587433, 0.17138265073299408, -0.23138320446014404, 0.030071191489696503, 0.17953845858573914, -1.004054307937622, 0.3021337687969208, 1.19991135597229, 0.2228361964225769, 0.1766050159931183, 0.2815667986869812, 0.9407156705856323, 0.4565882682800293, 0.6872668266296387, 0.04...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - On-device speech recognition - Permissions-policy integration: The use of the `available()` and `install()` methods is controlled by the `on-device-speech-recognition` `Permissions-Policy`. Specifically, where a defined policy blocks usage, any attempts to call these m...
[ 0.35836899280548096, -0.6114277243614197, -0.6296614408493042, 0.7471340298652649, -0.8963571786880493, -1.5001429319381714, 0.09182188659906387, 1.0638775825500488, 0.6247572898864746, 0.3385752737522125, -0.2508288621902466, 0.39002275466918945, 1.1568580865859985, 0.01755620539188385, ...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - On-device speech recognition - Specifying quality level requirements: The `available()` and `install()` methods both support the `quality` option. This allows you to check support for varying speech recognition complexity levels — for example, processing short voice co...
[ 0.8621675968170166, 0.17326302826404572, -0.1710326075553894, -0.15275436639785767, 0.36759376525878906, -0.7999772429466248, 0.8008846640586853, 1.8060235977172852, 0.03694058209657669, -0.021822646260261536, -0.20263461768627167, 0.3397424519062042, -0.09430735558271408, 0.32835745811462...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Contextual biasing in speech recognition: There will be times when a speech recognition service will fail to correctly recognize a specific word or phrase. This most often happens with domain-specific terms (such as medical or scientific vocabulary), proper nouns, unco...
[ 0.4863336980342865, 0.4798215329647064, -0.12684686481952667, -0.394753098487854, 0.3624119758605957, -1.068119764328003, 0.9948551654815674, 1.6279282569885254, 0.05454091727733612, -0.1806958168745041, -0.5948284268379211, 0.6183149814605713, -0.2300543487071991, 0.20031100511550903, -...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech synthesis: Speech synthesis (aka text-to-speech, or TTS) involves receiving synthesizing text contained within an app to speech, and playing it out of a device's speaker or audio output connection. The Web Speech API has a main controller interface for this — `...
[ 0.4265727698802948, 0.9854609370231628, -0.5213532447814941, 0.42628997564315796, 0.09852223098278046, -1.23768949508667, -0.05044150352478027, 1.3941798210144043, 0.15770627558231354, 0.5732517838478088, -0.574589192867279, 0.7867124676704407, 0.10240110754966736, -0.0899139866232872, -...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech synthesis - Demo: To demonstrate how to use web speech synthesis, we've created a sample app called Speech synthesizer. It has an input field for entering the text to be synthesized. You can adjust the rate and pitch and also select a voice from the dropdown men...
[ 0.07645408809185028, 0.492137610912323, -0.5153956413269043, -0.026165304705500603, -0.3938427269458771, -1.3554197549819946, 0.37031280994415283, 1.3799854516983032, -0.20386353135108948, 0.31862321496009827, 0.050925493240356445, 0.6267489194869995, 0.06782609969377518, -0.21100381016731...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech synthesis - HTML and CSS: The HTML and CSS for this app are pretty basic. There's a title, some instructions for use, and a form with some basic controls. The `select` element is initially empty; it is populated with `option`s via JavaScript (covered later). Ex...
[ 0.25975123047828674, 0.5017695426940918, -0.4461538791656494, 0.060197897255420685, 0.26329705119132996, -1.2985512018203735, 1.0257145166397095, 1.3863211870193481, -0.6613488793373108, 0.20665700733661652, 0.22912105917930603, 0.23292317986488342, 0.3216049075126648, -0.04227432236075401...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech synthesis - JavaScript: Let's investigate the JavaScript that powers this app.
[ -0.2760546803474426, 0.9185327887535095, -0.1000513806939125, 0.1399400383234024, -0.898271918296814, -0.8936344981193542, 0.13039743900299072, 0.3233487606048584, -0.298251748085022, 0.3241182267665863, -0.811172604560852, 0.056244611740112305, -0.2546854019165039, 0.12338660657405853, ...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech synthesis - JavaScript - Setting variables: First of all, we capture references to all the DOM elements involved in the UI, but more interestingly, we capture a reference to `Window.speechSynthesis`. This is API's entry point — it returns an instance of `SpeechS...
[ 0.373281866312027, 0.7038756608963013, -0.5971779823303223, 0.28659772872924805, -0.07180744409561157, -1.1815041303634644, 0.6826173663139343, 1.3248469829559326, 0.1302434504032135, 0.330815851688385, -0.16069455444812775, 0.6380316615104675, 0.3998602032661438, 0.015984289348125458, -...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech synthesis - JavaScript - Populating the select element: To populate the `select` element with the different voice options the device has available, we've written a `populateVoiceList()` function. We first invoke `SpeechSynthesis.getVoices()`, which returns a lis...
[ 1.182748556137085, 0.4388527572154999, -0.4514421820640564, 0.98833167552948, -0.21192413568496704, -1.4722262620925903, 1.0344632863998413, 1.4147247076034546, -0.20569384098052979, 0.3551263213157654, 0.030842654407024384, 0.3791273534297943, 0.3558882772922516, 0.12063644826412201, 0....
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech synthesis - JavaScript - Speaking the entered text: Next, we create an event handler to start speaking the text entered into the text field. We are using an onsubmit handler on the form so that the action happens when Enter/Return is pressed. We first create a n...
[ 0.4377397298812866, 0.8562535643577576, -0.37912896275520325, 0.08572342991828918, 0.22100728750228882, -1.0684528350830078, 0.6493552327156067, 1.2623448371887207, -0.1573004424571991, 0.018271179869771004, -0.2553333044052124, 0.7404800057411194, -0.27466392517089844, 0.29588383436203003...
api/web_speech_api/using_the_web_speech_api/index.md
API - Web Speech API - Using the Web Speech API - Speech synthesis - JavaScript - Updating the displayed pitch and rate values: The last part of the code updates the `pitch`/`rate` values displayed in the UI, each time the slider positions are moved. Example: pitch.onchange = () => { pitchValue.textContent = pitch...
[ -0.15331709384918213, -0.36961328983306885, -0.6676578521728516, 0.4264669716358185, -0.42364901304244995, -1.1505078077316284, -0.014774225652217865, 1.4724092483520508, 0.33400559425354004, -0.39809107780456543, 0.19934812188148499, 0.4095112085342407, 0.27666646242141724, -0.01901101320...
api/location/ancestororigins/index.md
API - Location - ancestorOrigins: The `ancestorOrigins` read-only property of the `Location` interface is a static `DOMStringList` containing, in reverse order, the origins of all ancestor browsing contexts of the document associated with the given `Location` object. You can use `location.ancestorOrigins` in the scri...
[ 0.7333747148513794, -0.3634585738182068, -0.059423401951789856, 0.12381365895271301, 0.07602685689926147, -0.8112732172012329, 0.052103132009506226, 0.9624843001365662, 0.35058721899986267, 0.15599893033504486, -0.048294469714164734, 0.6926426291465759, 0.1600685566663742, 0.09128613770008...
api/location/ancestororigins/index.md
API - Location - ancestorOrigins - Value: A `DOMStringList`.
[ -0.6813201308250427, -0.8090707659721375, 0.05248238146305084, -0.006240192800760269, -0.3522125482559204, -1.813521385192871, 0.9318379759788513, 0.5199097990989685, -0.11977934092283249, 0.1415318101644516, -0.10471415519714355, 0.8184508085250854, -0.28422367572784424, -0.17772306501865...
api/windowclient/ancestororigins/index.md
API - WindowClient - ancestorOrigins: Note: This feature is available in Web Workers. The `ancestorOrigins` read-only property of the `WindowClient` interface is an array of strings listing the origins of all ancestors of the browsing context represented by this `WindowClient` in reverse order. The first element in ...
[ 0.01432337798178196, -0.21499042212963104, -0.2965999245643616, 0.7042491436004639, 0.06012380123138428, -0.9420453906059265, 0.6561298370361328, 0.5850511193275452, 0.4620859622955322, 0.6287891268730164, 0.3200036287307739, 0.528979480266571, 0.7107142210006714, 0.5368654131889343, -0....
api/windowclient/ancestororigins/index.md
API - WindowClient - ancestorOrigins - Value: An array of strings.
[ -1.0985196828842163, -0.3024648427963257, 0.008159011602401733, -0.1998911052942276, -0.4046024978160858, -1.3775237798690796, 0.8929199576377869, 0.29585036635398865, 0.11869773268699646, -0.1785968393087387, 0.1093960553407669, -0.16210691630840302, -0.17643657326698303, 0.11384770274162...
api/htmlimageelement/sizes/index.md
API - HTMLImageElement - sizes: The `sizes` property of the `HTMLImageElement` interface allows you to specify the layout width of the image for each of a list of media queries, or `auto` for lazy-loaded images to allow the browser to automatically select an image to display based on the layout size of the element. Th...
[ 0.19382372498512268, -0.3802848160266876, -0.6835201978683472, 0.030537210404872894, 0.1738908290863037, -1.1743426322937012, 0.7992818355560303, 1.3231298923492432, -0.28130850195884705, -0.29397904872894287, -0.14128190279006958, 0.8613912463188171, -0.007089003920555115, 0.5688070654869...
api/htmlimageelement/sizes/index.md
API - HTMLImageElement - sizes - Value: A string that can be the `auto` keyword (optionally followed by any number of source sizes), or one or more source sizes. See the `sizes` attribute in the HTML `<img>` reference for more information.
[ -0.576679527759552, -0.16742029786109924, -0.055425964295864105, 0.0997314453125, -0.1492116004228592, -1.7603117227554321, 0.8488157391548157, 0.2634272277355194, -0.3284730315208435, -0.15327002108097076, -0.74390709400177, 0.8027311563491821, 0.28307777643203735, -0.07844756543636322, ...
api/htmlimageelement/sizes/index.md
API - HTMLImageElement - sizes - Examples - Selecting an image to fit window width: This example demonstrates how the browser uses the `sizes` attribute to select an image from `srcset` based on the rendered width of the image at the current viewport width. It also allows you to see the effect of resizing the browser ...
[ -0.48928603529930115, 0.1582770198583603, -0.6289401650428772, 0.5681655406951904, -0.2715345025062561, -1.5836254358291626, 1.0885082483291626, 0.6117386817932129, -0.03739164024591446, -0.11819183826446533, -0.5835248231887817, 0.8485239744186401, 0.2332126796245575, 1.0018078088760376, ...
api/htmlimageelement/sizes/index.md
API - HTMLImageElement - sizes - Examples - Selecting an image to fit window width - HTML: In order to demonstrate the effect of lazy loading the images need to be initially hidden from the `visual viewport`, and then scrolled into view. This is achieved by having an outer `scroll-container` `div` that nests `spacer` ...
[ 0.02455286495387554, -0.21489942073822021, -0.5161378383636475, -0.22591927647590637, 1.021377682685852, -0.6581834554672241, 0.7992159724235535, 1.2416905164718628, -0.4423278570175171, -0.028637439012527466, -0.22963209450244904, 0.8269707560539246, -0.5527910590171814, 0.767305910587310...
api/htmlimageelement/sizes/index.md
API - HTMLImageElement - sizes - Examples - Automatic image selection for lazy loaded images: This example demonstrates how setting the `sizes` value to `auto` affects the selection of the image to load from the `srcset` when `img` elements are lazy-loaded. It also allows you to see the effect of changing the size of ...
[ -0.5867576599121094, -0.24409057199954987, -0.39772307872772217, 0.24047783017158508, -0.0943872407078743, -1.4747562408447266, 1.009247899055481, 1.0943055152893066, -0.40992894768714905, 0.07862851768732071, -0.7750511169433594, 0.5121203660964966, 0.11007332801818848, 0.7006832957267761...
api/htmlimageelement/sizes/index.md
API - HTMLImageElement - sizes - Examples - Automatic image selection for lazy loaded images - HTML: The HTML is similar to that in the previous example, except that it defines three near-identical `img` elements, each with a `srcset` indicating 3 images that are `600px`, `400px`, and `200px` wide, and with a `sizes` ...
[ -0.858056366443634, -1.0827058553695679, 0.19912928342819214, 0.3982835114002228, -0.11158719658851624, -0.7940319776535034, 0.08065437525510788, 0.4848678708076477, -0.059480372816324234, 0.4257280230522156, -0.2889774739742279, 0.3508557975292206, -0.6809382438659668, 0.14285396039485931...
api/htmlimageelement/sizes/index.md
API - HTMLImageElement - sizes - Examples - Automatic image selection for lazy loaded images - CSS: Here we show the CSS classes that set the size of the different image containers. Example: #scroll-container { height: 400px; overflow-y: scroll; border: 2px solid #cccccc; } #spacer { height: 600px; } #demo-w...
[ -1.269196629524231, -0.5202957391738892, -0.11697004735469818, -0.0713658556342125, 0.42270803451538086, -1.3041083812713623, -0.3239251971244812, 0.3922117054462433, 0.2058926522731781, 0.44169145822525024, -0.23010505735874176, 0.38694077730178833, -0.866795003414154, 0.601920485496521, ...
api/htmlimageelement/sizes/index.md
API - HTMLImageElement - sizes - Examples - Blog example: This example is a slightly more real-world case demonstrating how to select an image to fit a window width using source sizes. In this example, a blog-like layout is created, displaying some text and an image for which three size points are specified, dependin...
[ 0.2090524584054947, -0.06121237576007843, -0.45785462856292725, 0.16133882105350494, 0.32841166853904724, -1.452972173690796, 0.921923041343689, 1.1386488676071167, -0.16222193837165833, -0.26906296610832214, 0.04818696528673172, 1.3541908264160156, -0.3295226991176605, 0.962796688079834, ...
api/htmlimageelement/sizes/index.md
API - HTMLImageElement - sizes - Examples - Blog example - HTML: Example: <article> <h1>An amazing headline</h1> <div class="test"></div> <p> This is even more amazing content text. It's really spectacular. And fascinating. Oh, it's also clever and witty. Award-winning stuff, I'm sure. </p> <img ...
[ -0.710556149482727, -0.1974179744720459, 0.3695248067378998, 0.37764519453048706, 0.24927735328674316, -1.5189487934112549, -0.10139374434947968, 0.7253390550613403, 1.1150108575820923, 0.18564672768115997, -0.3730250597000122, 0.6634095311164856, -0.5122721195220947, -0.06312789767980576,...
api/htmlimageelement/sizes/index.md
API - HTMLImageElement - sizes - Examples - Blog example - CSS: Example: article { margin: 1em; max-width: 60em; min-width: 20em; border: 4em solid #880e4f; border-radius: 7em; padding: 1.5em; font: 16px "Open Sans", "Verdana", "Helvetica", "Arial", sans-serif; } article img { dis...
[ -0.177841454744339, 0.33972394466400146, 0.24667322635650635, -0.6979731917381287, 0.0255579873919487, -1.415784239768982, -0.039193667471408844, -0.11014889180660248, 0.023205742239952087, 0.07175393402576447, -0.5868161916732788, 0.7686930894851685, -0.3687358498573303, 0.142798110842704...
api/htmlimageelement/sizes/index.md
API - HTMLImageElement - sizes - Examples - Blog example - JavaScript: The JavaScript code handles the two buttons that let you toggle the third width option between 40em and 50em; this is done by handling the `click` event, using the JavaScript string `replace()` method to replace the relevant portion of the `sizes` ...
[ -0.193070188164711, -0.781840980052948, -0.07692446559667587, 0.3316085636615753, 0.06128412485122681, -1.4532413482666016, 0.8503981232643127, 0.6100519299507141, -0.6138100028038025, -0.22661666572093964, -0.4341731369495392, 1.059982180595398, -0.1596415489912033, 0.6833184957504272, ...
api/client/url/index.md
API - Client - url: Note: This feature is available in Web Workers. The `url` read-only property of the `Client` interface returns the URL of the current service worker client. Note that the `Client.url` property is not updated unless a new page is actually loaded. This means that it will not be updated if the user ...
[ -1.2340376377105713, 0.2595037817955017, -0.6477137804031372, -0.41719353199005127, 0.2525217533111572, -0.9832522869110107, 0.8074998259544373, 0.3233043849468231, -0.11829803884029388, 0.16536960005760193, 0.30741775035858154, 0.6469919681549072, 0.5341382622718811, -0.043373703956604004...
api/client/url/index.md
API - Client - url - Value: A string.
[ -2.0116066932678223, -0.12754592299461365, -1.0559641122817993, -1.007751226425171, -0.2644917964935303, -0.1758774071931839, 1.1199902296066284, 0.5190306901931763, 0.052152082324028015, -0.8736866116523743, 0.703369140625, -0.22847218811511993, -0.4506065547466278, -0.2532309591770172, ...
api/client/url/index.md
API - Client - url - Examples: Example: self.addEventListener("notificationclick", (event) => { console.log("On notification click: ", event.notification.tag); event.notification.close(); // This looks to see if the current is already open and // focuses if it is event.waitUntil( clients .matchAl...
[ -1.0982929468154907, -0.6098788380622864, -0.04226391017436981, -0.05161137133836746, 0.13993461430072784, -1.3833154439926147, 0.03372135013341904, 0.08703368902206421, 0.24400290846824646, 0.04662283509969711, -0.24842524528503418, 0.5749345421791077, -0.13956709206104279, 0.011672936379...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with: Note: A previous version of this proposal used the `assert` keyword instead of `with`. The assertion feature is now non-standard. Check the browser compatibility table for details. The import attributes feature instructs the runtime about how a module should be loaded, includi...
[ -0.23656824231147766, -0.9022210836410522, -0.8911348581314087, 1.3207889795303345, -0.8454833030700684, -0.8910682201385498, 0.7756259441375732, 0.49113184213638306, 0.38181447982788086, 0.24805782735347748, -0.4216867685317993, 0.511755108833313, -0.2578202784061432, 0.6824116706848145, ...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with - Syntax: Example: import { names } from "module-name" with {}; import { names } from "module-name" with { key: "data" }; import { names } from "module-name" with { key: "data", key2: "data2" }; import { names } from "module-name" with { key: "data", key2: "data2", /* …, */ key...
[ 0.6447075605392456, -0.30650630593299866, -1.0224530696868896, 0.5757829546928406, -0.8668628931045532, -1.456297516822815, 0.8549587726593018, 1.2287847995758057, -0.46104341745376587, 0.0017784284427762032, 0.01165226474404335, 1.1236426830291748, -1.0504988431930542, 0.3713287115097046,...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with - Syntax - Parameters: - `keyN`: An attribute key. Can be an identifier or a string literal. All keys must be unique and must be known to the runtime. - `"dataN"`: An attribute value. Must be a string literal.
[ -0.05970253422856331, -0.156086266040802, -0.7429406642913818, 0.139862522482872, -0.8362184166908264, -1.647263765335083, 0.7591685652732849, 1.0591790676116943, 0.06625886261463165, 0.4741731584072113, -0.30814632773399353, 0.42252328991889954, -1.3619838953018188, 0.6176373958587646, ...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with - Syntax - Exceptions: - `SyntaxError`: An unsupported `key` was specified in a static import. - `TypeError`: An unsupported `key` was specified in a dynamic import. Note that specifying an unsupported value for a supported key may also result in an exception in some cases, dep...
[ -0.19623474776744843, -0.6392868161201477, -0.7217856645584106, 0.6594946980476379, -0.2046511471271515, -1.3814369440078735, 0.4252678155899048, 1.9375715255737305, 0.05189700424671173, 0.5574475526809692, 0.23745349049568176, -0.04184576869010925, 0.09468796849250793, 0.2845291197299957,...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with - Description: Import attributes tell the runtime how a particular module should be loaded. The primary use case is to load non-JS modules, such as JSON modules and CSS modules. Consider the following statement: Example: import data from "https://example.com/data.json"; On t...
[ 1.3320411443710327, -0.2969534397125244, -1.4929696321487427, 0.717697262763977, 0.4325788617134094, -0.9709947109222412, 0.22177529335021973, 1.2167178392410278, -0.24328313767910004, 0.17329195141792297, -0.08436056226491928, 0.743458092212677, -0.33216509222984314, 0.2750651240348816, ...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with - Description - Standard attributes: The available attributes depend on the language and runtime environment. The ECMAScript standard defines the `type` attribute with the values `"json"` and `"text"`. The HTML specification also defines the `type` attribute with values `"json"...
[ -1.6016647815704346, -0.5805869102478027, -1.2536027431488037, -0.015075268223881721, -0.4818449318408966, -1.3628298044204712, 0.8191547393798828, 0.9341856241226196, 0.7078657150268555, 0.18481971323490143, 0.056463323533535004, 0.113734170794487, -0.07564196735620499, -0.391655057668685...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with - Description - Standard attributes - JSON Modules (`{ type: "json" }`): The `json` type indicates that the imported file must contain JSON. You can load JSON from a file into the `data` object using the following code: Example: import data from "https://example.com/data.json"...
[ 0.528569757938385, -0.4135260283946991, -1.5431183576583862, 0.6289319396018982, 0.2624931335449219, -0.608845055103302, 0.7729530334472656, 1.2792409658432007, -0.3195803165435791, -0.2824999988079071, -0.08182753622531891, 0.4948059320449829, 0.3334243595600128, 0.464477002620697, -0.7...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with - Description - Standard attributes - CSS Modules (`{ type: "css" }`): The HTML spec defines the `css` type, which imports a stylesheet into a script as an `CSSStyleSheet` object. The code below shows how you might import a style and add it to your document. The import will thr...
[ -0.9507086873054504, -0.3225877285003662, -1.435340166091919, 0.5538114309310913, 0.3074437379837036, -1.281651258468628, -0.31063613295555115, 0.4166426658630371, 0.455380380153656, 0.10610369592905045, 0.16550059616565704, 1.0908763408660889, 0.17396770417690277, -0.163828045129776, -0...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with - Description - Standard attributes - Text Modules (`{ type: "text" }`): The `text` type allows importing a module's source as a string value. You can load text from a file into the `text` string using the following code: Example: import text from "https://example.com/file.txt...
[ -0.2871260941028595, -0.9629647135734558, -0.8359072208404541, 0.9063180685043335, 0.34284666180610657, -1.7009341716766357, 1.367526888847351, 0.9142500758171082, 0.09573961794376373, -0.6715473532676697, -0.2780451774597168, 0.13239382207393646, -0.4531950056552887, -0.4447641670703888, ...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with - Description - Intended semantics for import attributes: An attribute can change the runtime's behavior at every stage of the module loading process: - Resolution: the attribute is part of the module specifier (the string in the `from` clause). Therefore, given the same string...
[ 0.11506620049476624, -0.7715969085693359, -1.133568525314331, 0.7907115817070007, -0.6073671579360962, -1.115845799446106, 0.48045462369918823, 0.592428982257843, 0.028244122862815857, 0.6757820844650269, -0.34689873456954956, 0.2565288543701172, -1.5222584009170532, 0.3885073959827423, ...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with - Examples - Importing JSON modules with the type attribute: In `data.json`: Example: { "name": "Shilpa" } In `index.html`: Example: <!doctype html> <html lang="en-US"> <head> <meta charset="utf-8" /> <script type="module"> import data from "./data.json" w...
[ -0.6573086380958557, -0.5698900818824768, -0.7975051999092102, 0.9157017469406128, -0.13969114422798157, -0.6588464379310608, 1.0810447931289673, 0.6989566087722778, -0.3426363170146942, 0.31157031655311584, 0.3033999800682068, 1.5250784158706665, -0.9047288298606873, -0.5490055680274963, ...
javascript/reference/statements/import/with/index.md
JavaScript - Statements - import - with - Examples - Using import attributes with dynamic import: Import attributes are also accepted as the second parameter of the `import()` syntax. Example: const data = await import("./data.json", { with: { type: "json" }, }); Note that, like static imports, dynamic imports ar...
[ -0.4314395487308502, -0.9148861765861511, -1.2013425827026367, 1.2984212636947632, -0.42125940322875977, -0.9207298159599304, 0.36148199439048767, 0.8786593079566956, 0.29483354091644287, 1.4177167415618896, -0.12168044596910477, 0.6008950471878052, -0.4015475809574127, -0.0143225416541099...
javascript/reference/global_objects/array/includes/index.md
JavaScript - Global Objects - Array - includes: The `includes()` method of `Array` instances determines whether an array includes a certain value among its entries, returning `true` or `false` as appropriate. Example: const array = [1, 2, 3]; console.log(array.includes(2)); // Expected output: true const pets = ["...
[ -1.019758701324463, -1.3302230834960938, -1.3005708456039429, 1.5851372480392456, -0.06350468844175339, -1.820872187614441, 0.09159908443689346, -0.360873818397522, -0.19759860634803772, 0.30630698800086975, -0.21588368713855743, 0.587285578250885, 0.47187989950180054, -0.12336932867765427...
javascript/reference/global_objects/array/includes/index.md
JavaScript - Global Objects - Array - includes - Syntax: Example: includes(searchElement) includes(searchElement, fromIndex)
[ -0.8866577744483948, -0.10219255834817886, -0.9163831472396851, 0.44707462191581726, -0.4668619632720947, -1.6268092393875122, 0.10120867192745209, 0.07193972170352936, -0.5498194694519043, -0.7443479895591736, -0.21324972808361053, 0.5142719745635986, -0.34867361187934875, -0.374172002077...
javascript/reference/global_objects/array/includes/index.md
JavaScript - Global Objects - Array - includes - Syntax - Parameters: - `searchElement`: The value to search for. - `fromIndex` (optional): Zero-based index at which to start searching, converted to an integer. - Negative index counts back from the end of the array — if `-array.length <= fromIndex < 0`, `fromIndex +...
[ -0.6897984147071838, -0.3191593587398529, -0.5934417247772217, 0.271844744682312, 0.1622183620929718, -1.5018659830093384, 0.6378640532493591, 0.23110559582710266, -0.5176859498023987, 0.003920826129615307, -0.836036205291748, 0.14065006375312805, -0.5758527517318726, 0.2695690989494324, ...
javascript/reference/global_objects/array/includes/index.md
JavaScript - Global Objects - Array - includes - Syntax - Return value: A boolean value which is `true` if the value `searchElement` is found within the array (or the part of the array indicated by the index `fromIndex`, if specified).
[ -1.0285056829452515, -0.002691531553864479, -0.8961740136146545, 0.6812866926193237, -0.4846518337726593, -1.569397211074829, 0.637431800365448, 0.2996530830860138, -0.5088619589805603, -0.41375941038131714, -0.4633694887161255, 0.8071343898773193, 0.3701615035533905, 0.17434477806091309, ...
javascript/reference/global_objects/array/includes/index.md
JavaScript - Global Objects - Array - includes - Description: The `includes()` method compares `searchElement` to elements of the array using the SameValueZero algorithm. This algorithm works like strict equality `===` (where `-0` and `+0` are considered equal), with the exception that `NaN` is considered equal to its...
[ -0.7016893029212952, -0.3956960439682007, -0.6131621599197388, 1.385082721710205, 0.44938117265701294, -1.3608015775680542, 1.9878911972045898, -0.02454409748315811, -0.9458180665969849, 0.8396118879318237, -0.549492597579956, 0.04173754155635834, 0.4811071753501892, -0.10165621340274811, ...
javascript/reference/global_objects/array/includes/index.md
JavaScript - Global Objects - Array - includes - Examples - Using includes(): Example: [1, 2, 3].includes(2); // true [1, 2, 3].includes(4); // false [1, 2, 3].includes(3, 3); // false [1, 2, 3].includes(3, -1); // true [1, 2, NaN].includes(NaN); // true ["1", "2", "3"].includes(3); // false
[ -0.8343014121055603, 0.08452726900577545, -0.8649495244026184, 0.6808239817619324, -0.14193947613239288, -1.4043480157852173, 0.9764142036437988, -0.31706199049949646, -0.8371599316596985, 0.20304563641548157, -0.6967287659645081, 0.40965721011161804, 0.7709170579910278, -0.821380019187927...
javascript/reference/global_objects/array/includes/index.md
JavaScript - Global Objects - Array - includes - Examples - fromIndex is greater than or equal to the array length: If `fromIndex` is greater than or equal to the length of the array, `false` is returned. The array will not be searched. Example: const arr = ["a", "b", "c"]; arr.includes("c", 3); // false arr.includ...
[ -0.8924679160118103, -0.6189002394676208, -0.8407797813415527, 0.3903430700302124, -0.4479447603225708, -1.2078914642333984, -0.17961592972278595, -0.1289246380329132, -0.7926889061927795, -0.28206661343574524, -0.5560271143913269, -0.13231101632118225, -0.440324991941452, 0.11946620047092...
javascript/reference/global_objects/array/includes/index.md
JavaScript - Global Objects - Array - includes - Examples - Computed index is less than 0: If `fromIndex` is negative, the computed index is calculated to be used as a position in the array at which to begin searching for `searchElement`. If the computed index is less than or equal to `0`, the entire array will be sea...
[ -1.530325174331665, -0.44273003935813904, -0.49481189250946045, 0.7769045829772949, 0.3810265362262726, -1.5709118843078613, 0.44679737091064453, -0.11910013109445572, -0.4238661229610443, 0.5156404376029968, -0.2934587597846985, -0.32677242159843445, -0.30451688170433044, 0.19477215409278...
javascript/reference/global_objects/array/includes/index.md
JavaScript - Global Objects - Array - includes - Examples - Using includes() on sparse arrays: You can search for `undefined` in a sparse array and get `true`. Example: console.log([1, , 3].includes(undefined)); // true
[ -0.8210513591766357, 0.48850303888320923, -1.1838561296463013, 1.1656776666641235, -0.3282009959220886, -1.2105695009231567, 1.0992828607559204, -0.3138200342655182, -0.5624730587005615, 0.4228420555591583, 0.09153688699007034, 0.3134878873825073, 0.4351833760738373, -0.39764702320098877, ...
javascript/reference/global_objects/array/includes/index.md
JavaScript - Global Objects - Array - includes - Examples - Calling includes() on non-array objects: The `includes()` method reads the `length` property of `this` and then accesses each property whose key is a nonnegative integer less than `length`. Example: const arrayLike = { length: 3, 0: 2, 1: 3, 2: 4, ...
[ -1.067583680152893, 0.09996407479047775, -0.8230331540107727, 1.0049868822097778, -0.009297668933868408, -1.203429102897644, 0.899235725402832, -0.44579747319221497, -0.8471872210502625, 0.23418763279914856, -0.43785035610198975, 0.2665928602218628, 0.3187004029750824, -0.2733694314956665,...
javascript/reference/global_objects/iterator/index.md
JavaScript - Global Objects - Iterator: An `Iterator` object is an object that conforms to the iterator protocol by providing a `next()` method that returns an iterator result object. All built-in iterators inherit from the `Iterator` class. The `Iterator` class provides a `[Symbol.iterator]()` method that returns the...
[ -0.9518243074417114, -0.36118993163108826, -0.6436389684677124, 0.3915484547615051, 0.17698439955711365, -1.9022589921951294, -0.6217353940010071, 0.8330349326133728, -0.5655088424682617, -0.01121475175023079, -0.6315779089927673, 0.20398485660552979, -0.3954888582229614, 0.626952290534973...
javascript/reference/global_objects/iterator/index.md
JavaScript - Global Objects - Iterator - Description: The following are all built-in JavaScript iterators: - The Array Iterator returned by `Array.prototype.values()`, `Array.prototype.keys()`, `Array.prototype.entries()`, `Array.prototype[Symbol.iterator]()`, `TypedArray.prototype.values()`, `TypedArray.prototype.ke...
[ -0.35057929158210754, -0.29468879103660583, -0.17715968191623688, 0.13858099281787872, 0.6389103531837463, -1.1373670101165771, 0.7991699576377869, 0.7064750790596008, -1.0980437994003296, 0.00949827115982771, 0.1438274085521698, 0.8496779799461365, -0.01584087684750557, 0.333954393863678,...
javascript/reference/global_objects/iterator/index.md
JavaScript - Global Objects - Iterator - Description - Iterator helper methods: Note: These methods are iterator helpers, not iterable helpers, because the only requirement for an object to be iterable is just the presence of a `[Symbol.iterator]()` method. There is no shared prototype to install these methods on. Th...
[ -0.15293242037296295, 0.17413011193275452, -0.8978221416473389, 0.5371448993682861, 0.7832414507865906, -0.7521851062774658, 0.38766607642173767, 0.6573330163955688, -0.27114740014076233, -0.03363758325576782, -0.2846989929676056, 0.40649282932281494, -0.8796079754829407, -0.24397629499435...
javascript/reference/global_objects/iterator/index.md
JavaScript - Global Objects - Iterator - Description - Iterator helper objects: Note: Iterator helper objects and iterator helper methods are two different concepts. An Iterator helper object is detectable at runtime, while "iterator helper method" is just a name for a set of methods for comprehension. Iterator helper...
[ 0.45369744300842285, -0.44852662086486816, -1.472708821296692, 0.6249072551727295, 0.36201977729797363, -1.2929164171218872, -0.38010430335998535, 0.8200423121452332, -0.5713232755661011, 0.24643465876579285, -0.5480017066001892, -0.031636420637369156, -0.3388364017009735, 0.39370205998420...
javascript/reference/global_objects/iterator/index.md
JavaScript - Global Objects - Iterator - Description - Proper iterators: There are two kinds of "iterators": objects that conform to the iterator protocol (which, at its minimum, only requires the presence of a `next()` method), and objects that inherit from the `Iterator` class, which enjoy the helper methods. They d...
[ -0.500031590461731, -0.4898383319377899, -1.108875036239624, 0.9330496191978455, 0.06614962220191956, -1.2530063390731812, -0.8317354321479797, 0.3572925329208374, -0.5501933097839355, 0.3193521201610565, -0.5094873905181885, 0.004520528018474579, -0.8021379709243774, -0.2032432109117508, ...
javascript/reference/global_objects/iterator/index.md
JavaScript - Global Objects - Iterator - Constructor: - `Iterator()`: Intended to be extended by other classes that create iterators. Throws an error when constructed by itself.
[ -0.7384003400802612, -0.13347876071929932, -0.2881103456020355, 0.09528130292892456, 0.18012675642967224, -1.6494126319885254, -0.9031901955604553, 0.7855567336082458, -1.0970983505249023, -0.19542458653450012, -0.6081095933914185, -0.015207137912511826, -1.0406930446624756, 0.037153393030...
javascript/reference/global_objects/iterator/index.md
JavaScript - Global Objects - Iterator - Static methods: - `Iterator.concat()`: Creates a new `Iterator` object from a list of iterable objects. The new iterator yields the values from each of the input iterables in sequence. - `Iterator.from()`: Creates a new `Iterator` object from an iterator or iterable object. - `...
[ -0.5158372521400452, -0.027894284576177597, -0.9015104174613953, 0.5952233672142029, 0.5626236796379089, -1.176312804222107, 0.21668599545955658, 0.526565432548523, -0.5347845554351807, 0.4804691970348358, -0.8058860301971436, -0.10152413696050644, -0.7671902775764465, 0.48320817947387695,...
javascript/reference/global_objects/iterator/index.md
JavaScript - Global Objects - Iterator - Instance properties: These properties are defined on `Iterator.prototype` and shared by all `Iterator` instances. - `Iterator.prototype.constructor`: The constructor function that created the instance object. For `Iterator` instances, the initial value is the `Iterator` constr...
[ -0.0009462067973800004, -0.016340801492333412, 0.25222116708755493, 1.0164012908935547, 0.7521475553512573, -0.8244701027870178, 0.10583145916461945, 0.5895903706550598, -0.33722370862960815, -0.1114974319934845, -0.6026569604873657, 0.028276555240154266, -0.1980908215045929, 0.02002457529...
javascript/reference/global_objects/iterator/index.md
JavaScript - Global Objects - Iterator - Instance methods: - `Iterator.prototype.drop()`: Returns a new iterator helper object that skips the given number of elements at the start of this iterator. - `Iterator.prototype.every()`: Returns `false` if it finds an element that does not satisfy the provided testing functio...
[ -0.4351271390914917, 0.42468535900115967, -0.05258770287036896, 0.7684108018875122, 0.44583022594451904, -0.31892549991607666, 0.5246444344520569, 0.811231255531311, -0.532509446144104, -0.14677511155605316, -0.9623419046401978, -0.04230595752596855, -0.5805824995040894, 0.5332826375961304...
javascript/reference/global_objects/iterator/index.md
JavaScript - Global Objects - Iterator - Examples - Using an iterator as an iterable: All built-in iterators are also iterable, so you can use them in a `for...of` loop: Example: const arrIterator = [1, 2, 3].values(); for (const value of arrIterator) { console.log(value); } // Logs: 1, 2, 3
[ -0.18630656599998474, 0.16017432510852814, -0.23795178532600403, 1.165964961051941, 0.04932031035423279, -1.353237509727478, -0.5617383122444153, 0.6456389427185059, -0.6012963056564331, 0.3559488356113434, 0.44095757603645325, 0.14921413362026215, -0.514868974685669, -0.03762902691960335,...
javascript/reference/global_objects/iterator/every/index.md
JavaScript - Global Objects - Iterator - every: The `every()` method of `Iterator` instances is similar to `Array.prototype.every()`: it returns `false` if it finds an element that does not satisfy the provided testing function. Otherwise, if the iterator is exhausted without finding such an element, it returns `true`...
[ -0.7108931541442871, -0.9652032256126404, -0.16197001934051514, 0.5720887184143066, -0.5445946455001831, -1.8275954723358154, 0.9549418687820435, 0.4822658896446228, -1.2943854331970215, 0.42836615443229675, -0.4561205208301544, -0.26218730211257935, 0.05557934194803238, 0.3029637634754181...
javascript/reference/global_objects/iterator/every/index.md
JavaScript - Global Objects - Iterator - every - Syntax: Example: every(callbackFn)
[ -0.5504675507545471, 0.09128174185752869, -0.5213543176651001, -0.16433513164520264, -1.1703605651855469, -1.7346338033676147, 1.0982946157455444, 0.18428413569927216, -0.8823643922805786, 0.2380945384502411, -0.5112192630767822, 0.5645822882652283, -0.8709834814071655, 1.002720832824707, ...
javascript/reference/global_objects/iterator/every/index.md
JavaScript - Global Objects - Iterator - every - Syntax - Parameters: - `callbackFn`: A function to execute for each element produced by the iterator. It should return a truthy value to indicate the element passes the test, and a falsy value otherwise. The function is called with the following arguments: - `element`...
[ -0.5645397305488586, -0.3777608275413513, -0.6285865306854248, -0.015391182154417038, -0.43074142932891846, -1.5450574159622192, 0.5064892768859863, -0.5139389038085938, -1.0154104232788086, 0.4679814577102661, -0.9878301024436951, 0.5932306051254272, -0.8658871650695801, 1.712389230728149...
javascript/reference/global_objects/iterator/every/index.md
JavaScript - Global Objects - Iterator - every - Syntax - Return value: `true` if `callbackFn` returns a `truthy` value for every element. Otherwise, `false`.
[ -1.2352979183197021, 0.018003609031438828, -0.14278262853622437, 0.07718808948993683, -1.0620622634887695, -1.9472217559814453, 1.1343828439712524, -0.5738374590873718, -1.2853072881698608, 0.6783928275108337, -0.7944329977035522, 0.5192620158195496, 0.02612081542611122, 1.1419037580490112...
javascript/reference/global_objects/iterator/every/index.md
JavaScript - Global Objects - Iterator - every - Description: `every()` iterates the iterator and invokes the `callbackFn` function once for each element. It returns `false` immediately if the callback function returns a falsy value. Otherwise, it iterates until the end of the iterator and returns `true`. If `every()`...
[ -0.6447862386703491, -0.014740562066435814, -0.599186360836029, 0.23878571391105652, -0.6097484230995178, -1.6311620473861694, 0.7206185460090637, -0.7624201774597168, -1.1921377182006836, 0.8377311825752258, -0.5530952215194702, 0.46790337562561035, -0.5484211444854736, 0.5675871968269348...
javascript/reference/global_objects/iterator/every/index.md
JavaScript - Global Objects - Iterator - every - Examples - Using every(): Example: function* fibonacci() { let current = 1; let next = 1; while (true) { yield current; [current, next] = [next, current + next]; } } const isEven = (x) => x % 2 === 0; console.log(fibonacci().every(isEven)); // false c...
[ -1.2127307653427124, -0.20267769694328308, -0.4695357382297516, 0.13891468942165375, -0.3526267409324646, -2.0480690002441406, 0.6213895082473755, 0.32957354187965393, -0.5416128039360046, 0.15125589072704315, -0.25119829177856445, 0.8766022324562073, 0.21595974266529083, 0.103477910161018...
javascript/reference/global_objects/iterator/find/index.md
JavaScript - Global Objects - Iterator - find: The `find()` method of `Iterator` instances is similar to `Array.prototype.find()`: it returns the first element produced by the iterator that satisfies the provided testing function. If no values satisfy the testing function, `undefined` is returned.
[ -0.5374220609664917, -0.5664273500442505, -0.6016676425933838, 0.7825095653533936, -0.17380458116531372, -0.6276097893714905, 0.13213613629341125, 0.7661120891571045, -0.9928276538848877, 0.8793614506721497, -0.3393682539463043, -0.1740572303533554, -0.4231005907058716, 0.6893622875213623,...
javascript/reference/global_objects/iterator/find/index.md
JavaScript - Global Objects - Iterator - find - Syntax: Example: find(callbackFn)
[ -0.7309154868125916, 0.22052665054798126, -0.7679569721221924, -0.0366550013422966, -0.7174116969108582, -1.283028483390808, 0.3651255667209625, 0.6827945113182068, -1.0493576526641846, 0.3480640947818756, -0.3718208074569702, 0.5513514280319214, -1.1699864864349365, 1.3059684038162231, ...
javascript/reference/global_objects/iterator/find/index.md
JavaScript - Global Objects - Iterator - find - Syntax - Parameters: - `callbackFn`: A function to execute for each element produced by the iterator. It should return a truthy value to indicate a matching element has been found, and a falsy value otherwise. The function is called with the following arguments: - `ele...
[ -0.8185209035873413, -0.16541263461112976, -0.8294132351875305, 0.24129846692085266, -0.3033178150653839, -1.2493805885314941, 0.22789400815963745, -0.20635801553726196, -0.9510113596916199, 0.5723186135292053, -0.9682366847991943, 0.28937339782714844, -1.0642094612121582, 1.76419520378112...
javascript/reference/global_objects/iterator/find/index.md
JavaScript - Global Objects - Iterator - find - Syntax - Return value: The first element produced by the iterator that satisfies the provided testing function. Otherwise, `undefined` is returned.
[ -0.3086918890476227, 0.04087159410119057, -0.3129414916038513, 0.31907179951667786, -0.2733532786369324, -0.933544397354126, -0.08860424160957336, 0.813473641872406, -0.7601293921470642, 0.7050875425338745, -0.4465028643608093, 0.3688669800758362, -0.6597903370857239, 0.821717381477356, ...
javascript/reference/global_objects/iterator/find/index.md
JavaScript - Global Objects - Iterator - find - Description: `find()` iterates the iterator and invokes the `callbackFn` function once for each element. It returns the element immediately if the callback function returns a truthy value. Otherwise, it iterates until the end of the iterator and returns `undefined`. If `...
[ -0.4068235158920288, -0.0682007223367691, -0.9155973196029663, 0.38588401675224304, -0.24295400083065033, -1.2520865201950073, 0.5479567050933838, -0.4242105484008789, -1.1524009704589844, 1.0121228694915771, -0.5272120237350464, 0.29069191217422485, -0.9625158309936523, 0.9534076452255249...
javascript/reference/global_objects/iterator/find/index.md
JavaScript - Global Objects - Iterator - find - Examples - Using find(): Example: function* fibonacci() { let current = 1; let next = 1; while (true) { yield current; [current, next] = [next, current + next]; } } const isEven = (x) => x % 2 === 0; console.log(fibonacci().find(isEven)); // 2 const is...
[ -1.3350409269332886, -0.09063657373189926, -0.5903204083442688, 0.3548072278499603, -0.07448219507932663, -1.2009390592575073, 0.28008514642715454, 0.7905710935592651, -0.5977798700332642, 0.6365395784378052, -0.13924726843833923, 0.7494528889656067, -0.10513073951005936, 0.531425476074218...
javascript/reference/global_objects/iterator/includes/index.md
JavaScript - Global Objects - Iterator - includes: The `includes()` method of `Iterator` instances is similar to `Array.prototype.includes()`: it returns `true` if it finds an element that is equal to the given value. Otherwise, if the iterator is exhausted without finding such an element, it returns `false`.
[ -0.7347283363342285, -0.6119013428688049, -0.39131391048431396, 0.888964831829071, -0.1926271915435791, -1.6205495595932007, 1.0522888898849487, 0.17672309279441833, -1.11825430393219, 0.5516722202301025, -0.40467187762260437, -0.29985642433166504, 0.4705212116241455, 0.44183942675590515, ...
javascript/reference/global_objects/iterator/includes/index.md
JavaScript - Global Objects - Iterator - includes - Syntax: Example: includes(searchElement) includes(searchElement, fromIndex)
[ -1.2651301622390747, 0.1300015151500702, -0.7818781733512878, 0.4632710814476013, -0.20156018435955048, -1.3807523250579834, 0.03547128289937973, 0.07798358052968979, -0.8092239499092102, -0.44085362553596497, -0.31982624530792236, 0.3719736337661743, -0.43508052825927734, -0.0367219746112...
javascript/reference/global_objects/iterator/includes/index.md
JavaScript - Global Objects - Iterator - includes - Syntax - Parameters: - `searchElement`: The value to search for. - `fromIndex` (optional): Zero-based index at which to start searching. Must be a non-negative integer, `Infinity`, or `undefined`. If `fromIndex` is greater than or equal to the number of elements prod...
[ -1.1778538227081299, -0.20056889951229095, -0.3769872784614563, 0.21082982420921326, 0.15555588901042938, -1.3357696533203125, 0.42746245861053467, -0.054846785962581635, -0.7940484881401062, -0.047315116971731186, -0.6706151366233826, 0.20093268156051636, -0.7054046988487244, 0.3017691969...