file stringlengths 16 94 | text stringlengths 32 24.4k | vector list |
|---|---|---|
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Description - Number coercion:
Many built-in operations that expect numbers first coerce their arguments to numbers (which is largely why `Number` objects behave similarly to number primitives). The operation can be summarized as follows:
- Numbers are returned as-is.
- `undefin... | [
-0.21976733207702637,
-0.23049943149089813,
-0.5499773621559143,
0.2570003271102905,
0.33274832367897034,
-0.32133516669273376,
0.3301028311252594,
0.66134113073349,
-0.3946091830730438,
-0.19751505553722382,
-0.9655830264091492,
-0.4255664050579071,
-0.6983064413070679,
0.2649952173233032... |
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Description - Number coercion - Integer conversion:
Some operations expect integers, most notably those that work with array/string indices, date/time components, and number radixes. After performing the number coercion steps above, the result is truncated to an integer (by disca... | [
-0.9753415584564209,
0.5676075220108032,
-0.44421514868736267,
0.4215288460254669,
-0.4420313835144043,
-1.1664124727249146,
0.07706379145383835,
0.2138833850622177,
-0.26115483045578003,
0.7500114440917969,
-1.0807993412017822,
-0.5429725050926208,
-0.1562032550573349,
-0.3079280555248260... |
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Description - Number coercion - Fixed-width number conversion:
JavaScript has some lower-level functions that deal with the binary encoding of integer numbers, most notably bitwise operators and `TypedArray` objects. Bitwise operators always convert the operands to 32-bit integer... | [
-0.9579037427902222,
-0.01162517350167036,
-0.7778432369232178,
0.39096692204475403,
0.10544992983341217,
-0.650638222694397,
0.2991634011268616,
0.4048033356666565,
-0.4894919693470001,
0.9943448901176453,
-1.7516825199127197,
-0.1307295262813568,
-0.2715163826942444,
0.02706855535507202,... |
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Constructor:
- `Number()`: Creates `Number` objects. When called as a function, it returns primitive values of type Number. | [
-0.6465133428573608,
-0.07048670947551727,
-1.1253412961959839,
-0.17288970947265625,
-0.4462049901485443,
-1.3476510047912598,
0.17273762822151184,
0.5806555151939392,
-0.621088445186615,
0.12080421298742294,
-1.1848106384277344,
0.19008538126945496,
-0.3621891438961029,
-0.04851921647787... |
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Static properties:
- `Number.EPSILON`: The smallest interval between two representable numbers.
- `Number.MAX_SAFE_INTEGER`: The maximum safe integer in JavaScript (253 - 1).
- `Number.MAX_VALUE`: The largest positive representable number.
- `Number.MIN_SAFE_INTEGER`: The minimum... | [
-1.249745488166809,
-0.5076854228973389,
-0.35975340008735657,
0.2699674963951111,
0.03093705326318741,
-1.951907753944397,
0.785038948059082,
-0.5054377913475037,
0.01018446683883667,
0.8636178970336914,
-0.9320622086524963,
0.9059104323387146,
-0.7404155135154724,
-0.7067182660102844,
... |
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Static methods:
- `Number.isFinite()`: Determine whether the passed value is a finite number.
- `Number.isInteger()`: Determine whether the passed value is an integer.
- `Number.isNaN()`: Determine whether the passed value is `NaN`.
- `Number.isSafeInteger()`: Determine whether t... | [
-0.5890645980834961,
-0.348761647939682,
-0.7698561549186707,
-0.1498202681541443,
-0.00048448890447616577,
-1.68473482131958,
1.3201608657836914,
-0.17752547562122345,
-0.1862855702638626,
1.0812548398971558,
-1.256929874420166,
-0.34088507294654846,
0.07624295353889465,
0.223979115486145... |
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Instance properties:
These properties are defined on `Number.prototype` and shared by all `Number` instances.
- `Number.prototype.constructor`: The constructor function that created the instance object. For `Number` instances, the initial value is the `Number` constructor. | [
0.01384151540696621,
-0.4373055100440979,
-0.8206908702850342,
0.09984681010246277,
-0.1725015938282013,
-1.5988191366195679,
-0.26713523268699646,
0.5841727256774902,
0.4092675745487213,
-0.028716351836919785,
-1.1323697566986084,
0.052955180406570435,
-0.5249342322349548,
0.4997625350952... |
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Instance methods:
- `Number.prototype.toExponential()`: Returns a string representing the number in exponential notation.
- `Number.prototype.toFixed()`: Returns a string representing the number in fixed-point notation.
- `Number.prototype.toLocaleString()`: Returns a string with... | [
-0.7007607221603394,
-0.5291778445243835,
-0.5095208883285522,
-0.7112236022949219,
-0.20576563477516174,
-2.413914203643799,
0.584046483039856,
0.09932795912027359,
-0.002539224922657013,
-0.25026798248291016,
-0.8699393272399902,
1.2855994701385498,
-0.34212732315063477,
-0.0629270374774... |
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Examples - Using the Number object to assign values to numeric variables:
The following example uses the `Number` object's properties to assign values to several numeric variables:
Example:
const biggestNum = Number.MAX_VALUE;
const smallestNum = Number.MIN_VALUE;
const infinit... | [
-0.6100790500640869,
0.042434416711330414,
-0.6915091872215271,
0.4821094274520874,
-0.7579975724220276,
-1.304172396659851,
0.7067108154296875,
-0.21906709671020508,
0.17885729670524597,
-0.0495888814330101,
-0.5766512751579285,
0.3449312448501587,
-0.3604247570037842,
-0.3638920485973358... |
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Examples - Integer range for Number:
The following example shows the minimum and maximum integer values that can be represented as `Number` object.
Example:
const biggestInt = Number.MAX_SAFE_INTEGER; // (2**53 - 1) => 9007199254740991
const smallestInt = Number.MIN_SAFE_INTEGE... | [
-1.0298830270767212,
0.12817411124706268,
-1.1054316759109497,
0.03477541357278824,
0.22106581926345825,
-1.536138653755188,
-0.6923084259033203,
-0.13797256350517273,
-0.5889828205108643,
0.43218958377838135,
-0.23632438480854034,
1.174784541130066,
-0.9533714056015015,
-0.631528913974762... |
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Examples - Using Number() to convert a Date object:
The following example converts the `Date` object to a numerical value using `Number` as a function:
Example:
const d = new Date("1995-12-17T03:24:00");
console.log(Number(d));
This logs `819199440000`. | [
-0.3345903754234314,
-0.06579866260290146,
-1.2106424570083618,
0.5265975594520569,
-0.381634384393692,
-1.2328212261199951,
-0.20224501192569733,
0.42535680532455444,
-0.23141901195049286,
-0.0838090106844902,
-0.16086432337760925,
0.14151589572429657,
0.33545005321502686,
-0.500710368156... |
javascript/reference/global_objects/number/index.md | JavaScript - Global Objects - Number - Examples - Convert numeric strings and null to numbers:
Example:
Number("123"); // 123
Number("123") === 123; // true
Number("12.3"); // 12.3
Number("12.00"); // 12
Number("123e-1"); // 12.3
Number(""); // 0
Number(null); // 0
Number("0x11"); // 17
Number("0b11"); // 3
Number("0... | [
-0.65664142370224,
0.02332353964447975,
-0.31458213925361633,
-0.9003050327301025,
-0.5759936571121216,
-1.51305091381073,
1.0036587715148926,
-0.3585799038410187,
-0.15511620044708252,
-0.05076652020215988,
-0.9460534453392029,
0.316622257232666,
-0.1806793510913849,
-0.49649879336357117,... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise:
The `Promise` object represents the eventual completion (or failure) of an asynchronous operation and its resulting value.
To learn about the way promises work and how you can use them, we advise you to read Using promises first. | [
-0.903804361820221,
0.3649641275405884,
-0.6969244480133057,
-0.2322084605693817,
-0.41780784726142883,
-1.4405453205108643,
0.2284410297870636,
0.5684754252433777,
-0.07186979055404663,
0.46504300832748413,
-0.8925474882125854,
-0.020812511444091797,
0.23798906803131104,
0.83613121509552,... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Description:
A `Promise` is a proxy for a value not necessarily known when the promise is created. It allows you to associate handlers with an asynchronous action's eventual success value or failure reason. This lets asynchronous methods return values like synchronous methods: i... | [
-0.20555926859378815,
0.8242080807685852,
-0.3957960307598114,
-0.28946685791015625,
0.8189956545829773,
0.2636370062828064,
0.29019248485565186,
0.6415189504623413,
-0.7642787098884583,
-0.05512302368879318,
-1.0900378227233887,
0.5102313160896301,
-0.2281910479068756,
1.0173898935317993,... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Description - Chained Promises:
The promise methods `then()`, `catch()`, and `finally()` are used to associate further action with a promise that becomes settled. The `then()` method takes up to two arguments; the first argument is a callback function for the fulfilled case of t... | [
-0.7659631371498108,
0.5655595064163208,
-0.33024123311042786,
-0.03354227542877197,
0.7108749151229858,
-0.4725773334503174,
0.2035626471042633,
1.216191291809082,
-0.8014088273048401,
0.05139873921871185,
-0.7156506776809692,
0.13239482045173645,
-0.33331307768821716,
0.7568771243095398,... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Description - Thenables:
The JavaScript ecosystem had made multiple Promise implementations long before it became part of the language. Despite being represented differently internally, at the minimum, all Promise-like objects implement the Thenable interface. A thenable impleme... | [
-0.410837858915329,
0.9921504259109497,
-0.47442132234573364,
0.407286673784256,
-0.263815313577652,
-1.1409169435501099,
0.1324058175086975,
0.8347340226173401,
-1.4134427309036255,
0.3783421218395233,
-0.0918341875076294,
-0.2840285897254944,
0.04668896645307541,
0.3996891975402832,
0.... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Description - Promise concurrency:
The `Promise` class offers four static methods to facilitate async task concurrency:
- `Promise.all()`: Fulfills when all of the promises fulfill; rejects when any of the promises rejects.
- `Promise.allSettled()`: Fulfills when all promises s... | [
-1.3358961343765259,
0.30985966324806213,
-0.769390344619751,
-0.16966761648654938,
0.2665942311286926,
-0.3082617223262787,
0.5332541465759277,
0.5428056716918945,
-0.26123273372650146,
0.6248630285263062,
-1.246778130531311,
-0.1664089858531952,
0.105396568775177,
0.3410649001598358,
0... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Constructor:
- `Promise()`: Creates a new `Promise` object. The constructor is primarily used to wrap functions that do not already support promises. | [
-1.6064928770065308,
-0.20245938003063202,
-0.559647798538208,
0.255685418844223,
0.009876877069473267,
-1.8803162574768066,
-0.41749829053878784,
1.0381535291671753,
-0.7045304775238037,
0.09569893032312393,
-0.9566091299057007,
-0.0063702501356601715,
-0.24402378499507904,
0.413346350193... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Static properties:
- `Promise[Symbol.species]`: Returns the constructor used to construct return values from promise methods. | [
-1.5307923555374146,
0.12544694542884827,
-0.633967936038971,
-0.4500427544116974,
-0.5506784915924072,
-1.8138477802276611,
0.6316455006599426,
1.4772380590438843,
-0.8613796830177307,
0.33979320526123047,
-0.9369462728500366,
0.6342617869377136,
0.19355295598506927,
0.6382182836532593,
... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Static methods:
- `Promise.all()`: Takes an iterable of promises as input and returns a single `Promise`. This returned promise fulfills when all of the input's promises fulfill (including when an empty iterable is passed), with an array of the fulfillment values. It rejects whe... | [
-0.6548035740852356,
0.6379185914993286,
-0.24675092101097107,
-0.11584750562906265,
0.4835358262062073,
-0.2120697796344757,
0.4375130832195282,
0.7354217767715454,
-0.6481108069419861,
-0.06052879989147186,
-0.8371111750602722,
0.10271371901035309,
-0.09281639754772186,
0.320304960012435... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Instance properties:
These properties are defined on `Promise.prototype` and shared by all `Promise` instances.
- `Promise.prototype.constructor`: The constructor function that created the instance object. For `Promise` instances, the initial value is the `Promise` constructor.... | [
-0.8818702101707458,
-0.15346039831638336,
-0.42544904351234436,
0.17532162368297577,
0.1104552298784256,
-2.000885248184204,
0.1418868750333786,
1.1712629795074463,
0.05150049924850464,
-0.03758304566144943,
-0.9806784391403198,
0.07426552474498749,
-0.4405691921710968,
0.2412087619304657... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Instance methods:
- `Promise.prototype.catch()`: Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled.
- `Promise.pro... | [
-0.889002799987793,
-0.0003980398178100586,
-0.27954819798469543,
-0.1438320279121399,
-0.2500435709953308,
-1.0790061950683594,
0.8584511876106262,
0.3895755112171173,
-0.8021469712257385,
0.17653438448905945,
-1.014023780822754,
0.5853661298751831,
0.13636668026447296,
0.8865559101104736... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Examples - Basic Example:
In this example, we use `setTimeout(...)` to simulate async code. In reality, you will probably be using something like XHR or an HTML API.
Example:
const myFirstPromise = new Promise((resolve, reject) => {
// We call resolve(...) when what we were ... | [
-0.8778365850448608,
0.22914093732833862,
-0.1609140932559967,
-0.0716710239648819,
-0.2592114210128784,
-0.8879715204238892,
0.6284464597702026,
0.5331129431724548,
0.08502565324306488,
0.6317190527915955,
-0.39915525913238525,
-0.11611868441104889,
-0.33320578932762146,
0.254529297351837... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Examples - Example with diverse situations:
This example shows diverse techniques for using Promise capabilities and diverse situations that can occur. To understand this, start by scrolling to the bottom of the code block, and examine the promise chain. Upon provision of an ini... | [
-0.0537031851708889,
0.40537476539611816,
0.2094256728887558,
-0.14895129203796387,
0.4311196208000183,
-1.0234203338623047,
0.6103172898292542,
1.481876254081726,
-0.30908602476119995,
-0.2379922866821289,
-0.6314117312431335,
0.6512481570243835,
-0.23782743513584137,
0.20762208104133606,... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Examples - Advanced Example:
This small example shows the mechanism of a `Promise`. The `testPromise()` method is called each time the `button` is clicked. It creates a promise that will be fulfilled, using `setTimeout()`, to the promise count (number starting from 1) every 1-3 ... | [
-0.5525565147399902,
0.62675940990448,
-0.6043031811714172,
-0.15503770112991333,
-0.3039751648902893,
-1.2871308326721191,
1.0010418891906738,
0.6061498522758484,
-1.3363820314407349,
0.5825149416923523,
-0.5678953528404236,
0.3606105446815491,
-0.37734121084213257,
0.9619793891906738,
... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Examples - Advanced Example - HTML:
Example:
<button id="make-promise">Make a promise!</button>
<div id="log"></div> | [
-0.6388526558876038,
0.5653045773506165,
-0.4910563826560974,
-0.48891374468803406,
-0.7611644268035889,
-1.3087462186813354,
1.0541033744812012,
0.7447002530097961,
-0.9280703067779541,
-0.21231994032859802,
-0.25465887784957886,
0.3535368740558624,
-0.9681512117385864,
0.46397864818573,
... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Examples - Advanced Example - JavaScript:
Example:
"use strict";
let promiseCount = 0;
function testPromise() {
const thisPromiseCount = ++promiseCount;
const log = document.getElementById("log");
// begin
log.insertAdjacentHTML("beforeend", `${thisPromiseCount}) Star... | [
0.2537464499473572,
0.46129345893859863,
-0.2955126166343689,
-0.07757820188999176,
0.7028455138206482,
-0.46397560834884644,
0.10324820876121521,
0.40850841999053955,
-1.1741853952407837,
0.25991928577423096,
-0.46620404720306396,
0.2695053219795227,
-0.30111753940582275,
0.57022798061370... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Examples - Loading an image with XHR:
Another example using `Promise` and `XMLHttpRequest` to load an image is shown below. Each step is commented on and allows you to follow the Promise and XHR architecture closely.
Example:
<h1>Promise example</h1>
Example:
function imgLoa... | [
-0.7801904082298279,
0.23969465494155884,
-0.08582513779401779,
0.2194707691669464,
0.5024495124816895,
-0.57846599817276,
0.29791295528411865,
0.5925971865653992,
-0.8042720556259155,
-0.5260634422302246,
-0.11179158836603165,
-0.17004388570785522,
-1.1119379997253418,
1.1509321928024292,... |
javascript/reference/global_objects/promise/index.md | JavaScript - Global Objects - Promise - Examples - Incumbent settings object tracking:
A settings object is an environment that provides additional information when JavaScript code is running. This includes the realm and module map, as well as HTML specific information such as the origin. The incumbent settings object... | [
-0.5385532379150391,
-0.0982486680150032,
-0.4586433172225952,
0.10291151702404022,
0.44888949394226074,
-1.2705256938934326,
-0.16065946221351624,
0.8184266090393066,
-0.05878576636314392,
-0.24153301119804382,
-1.034479022026062,
0.5726274847984314,
0.11766207218170166,
0.743499636650085... |
javascript/reference/global_objects/promise/all/index.md | JavaScript - Global Objects - Promise - all:
The `Promise.all()` static method takes an iterable of promises as input and returns a single `Promise`. This returned promise fulfills when all of the input's promises fulfill (including when an empty iterable is passed), with an array of the fulfillment values. It rejects... | [
-0.8289726972579956,
0.2680264115333557,
-0.6557954549789429,
-0.3488014042377472,
-0.042507074773311615,
-1.7041516304016113,
0.6793462634086609,
0.18484331667423248,
-1.1225481033325195,
0.4971264898777008,
-0.8212187886238098,
0.3853556513786316,
0.6733866333961487,
0.768037736415863,
... |
javascript/reference/global_objects/promise/all/index.md | JavaScript - Global Objects - Promise - all - Syntax:
Example:
Promise.all(iterable) | [
-0.0011407401179894805,
0.49104541540145874,
-0.4392702579498291,
-0.591477632522583,
-0.9356014132499695,
-1.5878995656967163,
0.23600277304649353,
1.333977222442627,
-0.6145443916320801,
-0.3480655550956726,
-0.22094418108463287,
0.4667093753814697,
-0.22478657960891724,
0.80663514137268... |
javascript/reference/global_objects/promise/all/index.md | JavaScript - Global Objects - Promise - all - Syntax - Parameters:
- `iterable`: An iterable (such as an `Array`) of promises. | [
0.32976797223091125,
0.5545278787612915,
-0.39544427394866943,
-0.16016662120819092,
-0.5532698035240173,
-1.0095020532608032,
0.28160610795021057,
1.3407965898513794,
-0.7490747570991516,
-0.16773174703121185,
-0.6031739711761475,
0.47161364555358887,
-0.500464916229248,
0.971364498138427... |
javascript/reference/global_objects/promise/all/index.md | JavaScript - Global Objects - Promise - all - Syntax - Return value:
A `Promise` that is:
- Already fulfilled, if the `iterable` passed is empty.
- Asynchronously fulfilled, when all the promises in the given `iterable` fulfill. The fulfillment value is an array of fulfillment values, in the order of the promises pas... | [
-0.5287745594978333,
0.6955951452255249,
0.010815083980560303,
-0.20292215049266815,
-0.4417804479598999,
-1.3651385307312012,
1.0177456140518188,
0.40539830923080444,
-0.7866536974906921,
0.5680873990058899,
-0.4752561151981354,
0.4292306900024414,
-0.5194092392921448,
1.5426169633865356,... |
javascript/reference/global_objects/promise/all/index.md | JavaScript - Global Objects - Promise - all - Description:
The `Promise.all()` method is one of the promise concurrency methods. It can be useful for aggregating the results of multiple promises. It is typically used when there are multiple related asynchronous tasks that the overall code relies on to work successfull... | [
-0.28729987144470215,
0.8759869337081909,
-1.0152784585952759,
-0.041707493364810944,
-0.4248225688934326,
-1.2659387588500977,
0.7139421701431274,
0.37314215302467346,
-0.6001993417739868,
0.4765731990337372,
-1.245907187461853,
0.6803229451179504,
0.1314154863357544,
0.5907569527626038,
... |
javascript/reference/global_objects/promise/all/index.md | JavaScript - Global Objects - Promise - all - Examples - Using Promise.all():
`Promise.all` waits for all fulfillments (or the first rejection).
Example:
const p1 = Promise.resolve(3);
const p2 = 1337;
const p3 = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("foo");
}, 100);
});
Promise.all(... | [
0.2889534533023834,
0.6045676469802856,
0.13442371785640717,
0.2269546389579773,
-0.049553755670785904,
-0.49446848034858704,
0.32956552505493164,
0.6502694487571716,
-1.174639344215393,
0.2883699834346771,
-0.787214994430542,
-0.3088286519050598,
0.42609384655952454,
0.9030412435531616,
... |
javascript/reference/global_objects/promise/all/index.md | JavaScript - Global Objects - Promise - all - Examples - Destructuring the result:
You will find destructuring very useful if you are batching together a known number of tasks.
Example:
// With then()
Promise.all([p1, p2, p3]).then(([a, b, c]) => {
console.log(a, b, c); // 3 1337 "foo"
});
// With await
const [a,... | [
-0.18211719393730164,
0.11799746751785278,
-0.9626483917236328,
0.24086877703666687,
-0.826254665851593,
-1.8114663362503052,
1.0442990064620972,
-0.4497605264186859,
-0.49204376339912415,
0.2674223482608795,
-1.1744871139526367,
0.022478200495243073,
-0.5051687955856323,
0.073394685983657... |
javascript/reference/global_objects/promise/all/index.md | JavaScript - Global Objects - Promise - all - Examples - Asynchronicity or synchronicity of Promise.all:
This following example demonstrates the asynchronicity of `Promise.all` when a non-empty `iterable` is passed:
Example:
// Passing an array of promises that are already resolved,
// to trigger Promise.all as soon... | [
-0.001168135553598404,
0.3652254343032837,
-0.03966999799013138,
-0.018325325101614,
0.3606393337249756,
-0.14667999744415283,
0.4141397476196289,
0.7224196195602417,
-0.40170612931251526,
0.18749909102916718,
-0.06522749364376068,
-0.11465739458799362,
-0.07315371930599213,
0.482094109058... |
javascript/reference/global_objects/promise/all/index.md | JavaScript - Global Objects - Promise - all - Examples - Using Promise.all() with async functions:
Within async functions, it's very common to "over-await" your code. For example, given the following functions:
Example:
function promptForDishChoice() {
return new Promise((resolve, reject) => {
const dialog = d... | [
-0.2236253172159195,
0.19284847378730774,
-1.0053985118865967,
0.5154527425765991,
-0.30323946475982666,
-1.0397239923477173,
0.5115017294883728,
0.6083246469497681,
-0.49644365906715393,
0.3499714732170105,
-0.43635451793670654,
0.3006090223789215,
-0.7522778511047363,
0.9511464834213257,... |
javascript/reference/global_objects/promise/all/index.md | JavaScript - Global Objects - Promise - all - Examples - Promise.all fail-fast behavior:
`Promise.all` is rejected if any of the elements are rejected. For example, if you pass in four promises that resolve after a timeout and one promise that rejects immediately, then `Promise.all` will reject immediately.
Example:
... | [
-0.876198947429657,
0.6806705594062805,
-0.4346861243247986,
-0.19072940945625305,
-0.34479430317878723,
-0.7111959457397461,
0.23640915751457214,
0.6371074914932251,
-0.8265858888626099,
0.6193332076072693,
-1.0162404775619507,
-0.1817348599433899,
-0.5225358009338379,
0.7536251544952393,... |
javascript/reference/global_objects/promise/any/index.md | JavaScript - Global Objects - Promise - any:
The `Promise.any()` static method takes an iterable of promises as input and returns a single `Promise`. This returned promise fulfills when any of the input's promises fulfills, with this first fulfillment value. It rejects when all of the input's promises reject (includin... | [
-1.1833548545837402,
0.45390501618385315,
-0.364817351102829,
-0.23285050690174103,
-0.14874029159545898,
-1.5651328563690186,
0.1343187391757965,
0.3813073933124542,
-0.8068311810493469,
0.6406764984130859,
-0.9177443981170654,
0.13426446914672852,
-0.06113490089774132,
0.7024188041687012... |
javascript/reference/global_objects/promise/any/index.md | JavaScript - Global Objects - Promise - any - Syntax:
Example:
Promise.any(iterable) | [
-0.3149932026863098,
0.6563273668289185,
-0.08209921419620514,
-0.8063295483589172,
-1.051195740699768,
-1.5835158824920654,
0.07767611742019653,
1.4314848184585571,
-0.3342243432998657,
-0.4793491065502167,
-0.2230459302663803,
0.4628278613090515,
-0.5482256412506104,
0.5017702579498291,
... |
javascript/reference/global_objects/promise/any/index.md | JavaScript - Global Objects - Promise - any - Syntax - Parameters:
- `iterable`: An iterable (such as an `Array`) of promises. | [
0.04969927668571472,
0.6004231572151184,
-0.3158140182495117,
-0.24596257507801056,
-0.6410998106002808,
-0.9800273180007935,
0.1394190788269043,
1.4331806898117065,
-0.584182858467102,
-0.16185100376605988,
-0.6569070219993591,
0.4537748694419861,
-0.7110311388969421,
0.8438909649848938,
... |
javascript/reference/global_objects/promise/any/index.md | JavaScript - Global Objects - Promise - any - Syntax - Return value:
A `Promise` that is:
- Already rejected, if the `iterable` passed is empty.
- Asynchronously fulfilled, when any of the promises in the given `iterable` fulfills. The fulfillment value is the fulfillment value of the first promise that was fulfilled... | [
-0.7602616548538208,
0.7898884415626526,
0.09729886054992676,
-0.23969806730747223,
-0.41861099004745483,
-1.2158254384994507,
1.067835807800293,
0.48266714811325073,
-0.8042388558387756,
0.4902747869491577,
-0.5413079857826233,
0.02774512767791748,
-0.686705470085144,
1.4654027223587036,
... |
javascript/reference/global_objects/promise/any/index.md | JavaScript - Global Objects - Promise - any - Description:
The `Promise.any()` method is one of the promise concurrency methods. This method is useful for returning the first promise that fulfills. It short-circuits after a promise fulfills, so it does not wait for the other promises to complete once it finds one.
Un... | [
-0.37954196333885193,
0.6112929582595825,
-0.00172397680580616,
0.09390817582607269,
0.6735849380493164,
-0.7492251396179199,
0.7474986910820007,
0.9208815097808838,
-0.517922043800354,
0.659976601600647,
-0.5877451300621033,
0.42540261149406433,
-0.1058083325624466,
0.35010653734207153,
... |
javascript/reference/global_objects/promise/any/index.md | JavaScript - Global Objects - Promise - any - Examples - Using Promise.any():
`Promise.any()` fulfills with the first promise to fulfill, even if a promise rejects first. This is in contrast to `Promise.race()`, which fulfills or rejects with the first promise to settle.
Example:
const pErr = new Promise((resolve, r... | [
-0.7970569729804993,
0.5521553754806519,
-0.07520395517349243,
-0.5053346157073975,
-0.8840204477310181,
-1.0816775560379028,
0.25352373719215393,
0.250801146030426,
0.1640939712524414,
0.1610689014196396,
-0.7952741384506226,
0.11366505920886993,
-0.4627879559993744,
0.4610954523086548,
... |
javascript/reference/global_objects/promise/any/index.md | JavaScript - Global Objects - Promise - any - Examples - Rejections with AggregateError:
`Promise.any()` rejects with an `AggregateError` if no promise fulfills.
Example:
const failure = new Promise((resolve, reject) => {
reject(new Error("Always fails"));
});
Promise.any([failure]).catch((err) => {
console.log... | [
-1.1555407047271729,
0.37023451924324036,
-0.21360096335411072,
-0.9643464088439941,
-0.7493897676467896,
-1.3880720138549805,
0.29038047790527344,
0.05241771042346954,
-1.0940710306167603,
0.019703496247529984,
-0.1876901537179947,
-0.4969097375869751,
-0.3729800581932068,
0.9562774896621... |
javascript/reference/global_objects/promise/any/index.md | JavaScript - Global Objects - Promise - any - Examples - Displaying the first image loaded:
In this example, we have a function that fetches an image and returns a blob. We use `Promise.any()` to fetch a couple of images and display the first one available (i.e., whose promise has resolved).
Example:
async function ... | [
-0.41882938146591187,
0.619143545627594,
-0.058661967515945435,
-0.15403538942337036,
0.18723902106285095,
-0.4638141095638275,
-0.3084673583507538,
0.6285993456840515,
-0.5798466205596924,
-0.17883197963237762,
-0.3651012182235718,
-0.8491862416267395,
-0.5525616407394409,
0.9854744672775... |
javascript/reference/global_objects/promise/race/index.md | JavaScript - Global Objects - Promise - race:
The `Promise.race()` static method takes an iterable of promises as input and returns a single `Promise`. This returned promise settles with the eventual state of the first promise that settles.
Example:
const promise1 = new Promise((resolve, reject) => {
setTimeout(re... | [
-1.4865071773529053,
0.06979376822710037,
-0.2300514429807663,
0.1597805619239807,
-0.31372523307800293,
-0.7985087633132935,
-0.04463827610015869,
1.3656672239303589,
-0.5228968858718872,
0.5304487943649292,
-1.0888675451278687,
0.5733763575553894,
0.2945766746997833,
0.6217334866523743,
... |
javascript/reference/global_objects/promise/race/index.md | JavaScript - Global Objects - Promise - race - Syntax:
Example:
Promise.race(iterable) | [
-0.7561565041542053,
0.38150256872177124,
0.09607473015785217,
-0.48232996463775635,
-1.0581426620483398,
-1.258949637413025,
-0.13928541541099548,
1.5547418594360352,
-0.9106200933456421,
-0.42121487855911255,
-0.4308173954486847,
0.48618751764297485,
-0.37727832794189453,
0.8129993081092... |
javascript/reference/global_objects/promise/race/index.md | JavaScript - Global Objects - Promise - race - Syntax - Parameters:
- `iterable`: An iterable (such as an `Array`) of promises. | [
-0.43853050470352173,
0.35816818475723267,
-0.18704305589199066,
-0.09591497480869293,
-0.5892297029495239,
-0.7691575288772583,
-0.009926104918122292,
1.5721515417099,
-0.8389770984649658,
-0.3690680265426636,
-0.9334457516670227,
0.60200434923172,
-0.621721088886261,
0.9816462993621826,
... |
javascript/reference/global_objects/promise/race/index.md | JavaScript - Global Objects - Promise - race - Syntax - Return value:
A `Promise` that asynchronously settles with the eventual state of the first promise in the `iterable` to settle. In other words, it fulfills if the first promise to settle is fulfilled, and rejects if the first promise to settle is rejected. The re... | [
-1.1554901599884033,
0.8302773833274841,
0.0640726089477539,
0.2660035490989685,
-0.7044228911399841,
-0.7620946764945984,
0.747198760509491,
1.2625824213027954,
-0.5266183614730835,
0.4458726644515991,
-0.40049830079078674,
0.6949194669723511,
-0.32633939385414124,
1.422990322113037,
0.... |
javascript/reference/global_objects/promise/race/index.md | JavaScript - Global Objects - Promise - race - Description:
The `Promise.race()` method is one of the promise concurrency methods. It's useful when you want the first async task to complete, but do not care about its eventual state (i.e., it can either succeed or fail).
If the iterable contains one or more non-promis... | [
-1.2554916143417358,
0.4725726246833801,
-0.1382659375667572,
0.43547743558883667,
-0.6084243655204773,
-0.612438440322876,
0.9953575134277344,
0.9555458426475525,
-0.6233023405075073,
0.23941834270954132,
-1.0182430744171143,
0.3711853325366974,
0.15853984653949738,
0.41926974058151245,
... |
javascript/reference/global_objects/promise/race/index.md | JavaScript - Global Objects - Promise - race - Examples - Using Promise.race():
This example shows how `Promise.race()` can be used to race several timers implemented with `setTimeout()`. The timer with the shortest time always wins the race and becomes the resulting promise's state.
Example:
function sleep(time, va... | [
-0.3509388566017151,
0.3303988575935364,
0.15824079513549805,
0.040795668959617615,
-0.28884321451187134,
-0.14848411083221436,
0.7532115578651428,
0.6923890709877014,
-0.8239619731903076,
-0.16735973954200745,
-0.9432360529899597,
0.25511786341667175,
-0.292424738407135,
0.232636868953704... |
javascript/reference/global_objects/promise/race/index.md | JavaScript - Global Objects - Promise - race - Examples - Asynchronicity of Promise.race:
This following example demonstrates the asynchronicity of `Promise.race`. Unlike other promise concurrency methods, `Promise.race` is always asynchronous: it never settles synchronously, even when the `iterable` is empty.
Exampl... | [
-0.8257380723953247,
-0.0633588433265686,
0.10478101670742035,
-0.02622593566775322,
0.3608584702014923,
-0.0343095026910305,
0.25379911065101624,
1.1208823919296265,
-0.3451491594314575,
0.02785375341773033,
-0.36708125472068787,
0.012063585221767426,
-0.33914318680763245,
0.6913809180259... |
javascript/reference/global_objects/promise/race/index.md | JavaScript - Global Objects - Promise - race - Examples - Using Promise.race() to implement request timeout:
You can race a potentially long-lasting request with a timer that rejects, so that when the time limit has elapsed, the resulting promise automatically rejects.
Example:
const data = Promise.race([
fetch("/... | [
-1.4247150421142578,
0.22438840568065643,
-0.08742965757846832,
0.5413773059844971,
-0.37321871519088745,
-1.382079005241394,
-0.2832193374633789,
0.4675765037536621,
-0.9724462628364563,
0.429799348115921,
-1.030935525894165,
0.45412421226501465,
-0.338523268699646,
1.295433759689331,
0... |
javascript/reference/global_objects/promise/race/index.md | JavaScript - Global Objects - Promise - race - Examples - Using Promise.race() to detect the status of a promise:
Because `Promise.race()` resolves to the first non-pending promise in the iterable, we can check a promise's state, including if it's pending. This example is adapted from `promise-status-async`.
Example:... | [
-0.4439144730567932,
0.1211012750864029,
0.15347495675086975,
-0.5089555978775024,
0.7445420622825623,
0.03797183185815811,
0.48687297105789185,
1.233091115951538,
-0.09924188256263733,
0.15743815898895264,
-0.596418559551239,
0.20458215475082397,
-0.32407674193382263,
0.8917533159255981,
... |
javascript/reference/global_objects/promise/race/index.md | JavaScript - Global Objects - Promise - race - Examples - Comparison with Promise.any():
`Promise.race` takes the first settled `Promise`.
Example:
const promise1 = new Promise((resolve, reject) => {
setTimeout(resolve, 500, "one");
});
const promise2 = new Promise((resolve, reject) => {
setTimeout(reject, 100,... | [
-0.5713890194892883,
-0.034338757395744324,
-0.09810174256563187,
0.1148964911699295,
0.41428399085998535,
-0.6979793310165405,
0.3383508324623108,
0.9018236994743347,
-0.627515435218811,
-0.07731392234563828,
-0.6383671760559082,
-0.22182995080947876,
-0.18362416326999664,
0.2518611848354... |
javascript/reference/regular_expressions/character_class/index.md | JavaScript - Regular expressions - Character class:
A character class matches any character in or not in a custom set of characters. When the `v` flag is enabled, it can also be used to match finite-length strings. | [
-0.4655524790287018,
-0.8887993097305298,
-1.0125830173492432,
0.3429684340953827,
0.2936175763607025,
-1.537371277809143,
1.270810842514038,
0.6375935077667236,
0.5946283936500549,
-0.7160472273826599,
-0.6284362077713013,
-0.5786548256874084,
0.16734947264194489,
0.013074800372123718,
... |
javascript/reference/regular_expressions/character_class/index.md | JavaScript - Regular expressions - Character class - Syntax:
Example:
[]
[abc]
[A-Z]
[^]
[^abc]
[^A-Z]
// `v` mode only
[operand1&&operand2]
[operand1--operand2]
[\q{substring}] | [
-0.2930377423763275,
0.0530100017786026,
-0.7136487364768982,
-0.17642493546009064,
-0.0902266651391983,
-0.04831694811582565,
1.0408724546432495,
1.3646377325057983,
0.6177393794059753,
-0.22624342143535614,
-0.37344780564308167,
-0.6907667517662048,
0.7468266487121582,
-0.429010123014450... |
javascript/reference/regular_expressions/character_class/index.md | JavaScript - Regular expressions - Character class - Syntax - Parameters:
- `operand1`, `operand2`: Can be a single character, another square-bracket-enclosed character class, a character class escape, a Unicode character class escape, or a string using the `\q` syntax.
- `substring`: A literal string. | [
-0.8263406157493591,
0.3576759397983551,
-0.8653597235679626,
-0.21969547867774963,
0.6205452084541321,
-1.682227373123169,
0.4583093822002411,
0.7446699142456055,
0.386038601398468,
-0.668135404586792,
-0.818917989730835,
-0.7571731805801392,
-0.03294847905635834,
-0.4295656681060791,
0... |
javascript/reference/regular_expressions/character_class/index.md | JavaScript - Regular expressions - Character class - Description:
A character class specifies a list of characters between square brackets and matches any character in the list. The `v` flag drastically changes how character classes are parsed and interpreted. The following syntaxes are available in both `v` mode and ... | [
-0.04973505437374115,
-0.15346559882164001,
-0.40463224053382874,
-0.5252693295478821,
0.9229294061660767,
-0.8986276388168335,
0.549156904220581,
1.0032188892364502,
0.7216682434082031,
-0.21655453741550446,
0.06623638421297073,
0.3511345386505127,
-0.561590313911438,
-0.5030645132064819,... |
javascript/reference/regular_expressions/character_class/index.md | JavaScript - Regular expressions - Character class - Description - Non-v-mode character class:
Non-`v`-mode character classes interpret most character literally and have less restrictions about the characters they can contain. For example, `.` is the literal dot character, not the wildcard. The only characters that ca... | [
-1.2933951616287231,
-1.2014740705490112,
-0.5186673402786255,
-0.24378728866577148,
0.2304157316684723,
-0.8877816200256348,
1.5789257287979126,
1.3661118745803833,
1.0508098602294922,
-0.37948641180992126,
0.2654237747192383,
0.2193058431148529,
-0.2096116691827774,
-0.5305770635604858,
... |
javascript/reference/regular_expressions/character_class/index.md | JavaScript - Regular expressions - Character class - Description - v-mode character class:
The basic idea of character classes in `v` mode remains the same: you can still use most characters literally, use `-` to denote character ranges, and use escape sequences. One of the most important features of the `v` flag is s... | [
-0.23573003709316254,
0.38660845160484314,
-0.3625588119029999,
0.3913874328136444,
0.5733192563056946,
-0.5193458199501038,
0.24545729160308838,
0.6637964844703674,
0.4454393982887268,
-0.2529253363609314,
0.15297609567642212,
-0.17121808230876923,
-0.6829004287719727,
-0.1453289687633514... |
javascript/reference/regular_expressions/character_class/index.md | JavaScript - Regular expressions - Character class - Description - Complement classes and case-insensitive matching:
Case-insensitive matching works by case-folding both the expected character set and the matched string. When specifying complement classes, the order in which JavaScript performs case-folding and comple... | [
-0.7502371072769165,
0.4908861517906189,
-0.32956549525260925,
0.12641742825508118,
1.2582330703735352,
-0.5043162107467651,
0.30961617827415466,
1.4052823781967163,
0.20468008518218994,
-0.13463646173477173,
-0.364290714263916,
0.25139522552490234,
0.015262898057699203,
0.5071197152137756... |
javascript/reference/regular_expressions/character_class/index.md | JavaScript - Regular expressions - Character class - Examples - Matching hexadecimal digits:
The following function determines whether a string contains a valid hexadecimal number:
Example:
function isHexadecimal(str) {
return /^[0-9A-F]+$/i.test(str);
}
isHexadecimal("2F3"); // true
isHexadecimal("beef"); // tru... | [
-1.6830267906188965,
-0.9749886989593506,
-0.38315171003341675,
0.04181402176618576,
-0.3516887128353119,
-1.1166629791259766,
1.625860333442688,
0.07017824053764343,
-0.019277531653642654,
0.0461365282535553,
-1.1560713052749634,
-0.4181332588195801,
-0.516887366771698,
-0.370222628116607... |
javascript/reference/regular_expressions/character_class/index.md | JavaScript - Regular expressions - Character class - Examples - Using intersection:
The following function matches Greek letters.
Example:
function greekLetters(str) {
return str.match(/[\p{Script_Extensions=Greek}&&\p{Letter}]/gv);
}
// 𐆊 is U+1018A GREEK ZERO SIGN
greekLetters("π𐆊P0零αAΣ"); // [ 'π', 'α', 'Σ' ... | [
-1.4815032482147217,
-0.6386958360671997,
-0.9796733260154724,
-0.4151113033294678,
0.5065542459487915,
-1.3050036430358887,
2.0673911571502686,
-0.6132466197013855,
0.9294220209121704,
0.05292307958006859,
0.09998273849487305,
0.6204016804695129,
0.565118134021759,
-0.7807089686393738,
... |
javascript/reference/regular_expressions/character_class/index.md | JavaScript - Regular expressions - Character class - Examples - Using subtraction:
The following function matches all non-ASCII numbers.
Example:
function nonASCIINumbers(str) {
return str.match(/[\p{Decimal_Number}--\d]/gv);
}
// 𑜹 is U+11739 AHOM DIGIT NINE
nonASCIINumbers("𐆊0零1𝟜𑜹a"); // [ '𝟜', '𑜹' ] | [
-1.2217988967895508,
-0.2212674766778946,
-0.9576200842857361,
-0.10841388255357742,
-0.23819781839847565,
-0.4715319573879242,
1.1965888738632202,
-0.6896609663963318,
0.07110042870044708,
-0.11919450759887695,
-0.49892953038215637,
-0.2853896915912628,
-0.136750727891922,
0.3464747667312... |
javascript/reference/regular_expressions/character_class/index.md | JavaScript - Regular expressions - Character class - Examples - Matching strings:
The following function matches all line terminator sequences, including the line terminator characters and the sequence `\r\n` (CRLF). The order in which the alternatives are specified does not matter, because the longest alternative, `\... | [
-0.056317657232284546,
0.06632301211357117,
0.324735164642334,
-0.25124210119247437,
0.9110088348388672,
-0.7944744825363159,
-0.1787240207195282,
0.34878963232040405,
-0.06731414794921875,
0.07830063253641129,
0.1008996069431305,
-0.5341150760650635,
-0.29355722665786743,
0.48180979490280... |
css/reference/selectors/_doublecolon_checkmark/index.md | CSS - Selectors - ::checkmark:
The `::checkmark` CSS pseudo-element targets the checkmark placed inside the currently-selected `option` element of a customizable select element. It can be used to provide a visual indication of which option is selected.
Example:
<label for="pet-select">
Select pet:
</label>
<br />
... | [
-0.010328274220228195,
-0.22354714572429657,
-1.8736943006515503,
1.119149088859558,
0.07728192210197449,
-2.043431520462036,
-0.3644464612007141,
1.0291653871536255,
-0.35114622116088867,
0.6045417189598083,
1.2724095582962036,
-0.2978176474571228,
0.23222869634628296,
0.5438132286071777,... |
css/reference/selectors/_doublecolon_checkmark/index.md | CSS - Selectors - ::checkmark - Syntax:
Example:
::checkmark {
/* ... */
} | [
0.5607365965843201,
-0.7009602785110474,
-1.423722267150879,
0.7988727688789368,
-0.5508916974067688,
-1.0236129760742188,
1.468192219734192,
1.5514897108078003,
0.33885931968688965,
-0.3685508966445923,
1.110107421875,
0.22287887334823608,
-0.21819357573986053,
-0.4698159098625183,
0.03... |
css/reference/selectors/_doublecolon_checkmark/index.md | CSS - Selectors - ::checkmark - Description:
The `::checkmark` pseudo-element targets the checkmark placed inside a customizable select element's currently-selected `<option>`.
It is only available to target when the originating element has a picker and has base appearance set on it via the `appearance` property `bas... | [
0.854066789150238,
0.09958739578723907,
-1.5361992120742798,
1.2079427242279053,
0.12264591455459595,
-1.4943366050720215,
1.3698300123214722,
0.9625155329704285,
-0.10439319908618927,
1.0886590480804443,
0.34527310729026794,
-0.16656509041786194,
-0.6121339797973633,
-0.03263586014509201,... |
css/reference/selectors/_doublecolon_checkmark/index.md | CSS - Selectors - ::checkmark - Examples - Customizing the checkmark:
To opt-in to customizable select functionality, the `<select>` element and its picker both need to have an `appearance` value of `base-select` set on them:
Example:
select,
::picker(select) {
appearance: base-select;
}
Assuming flexbox is being... | [
0.22662553191184998,
-0.4133932888507843,
-1.2163480520248413,
0.8640390634536743,
-0.14645110070705414,
-1.2764297723770142,
0.679428219795227,
0.6784877181053162,
-0.5993077158927917,
0.41353413462638855,
0.5457361340522766,
-0.053195081651210785,
-0.5630320310592651,
-0.1534108221530914... |
css/reference/selectors/_doublecolon_first-line/index.md | CSS - Selectors - ::first-line:
The `::first-line` CSS pseudo-element applies styles to the first line of a block container.
Example:
p::first-line {
font-size: 1.2rem;
font-weight: bold;
text-decoration: underline;
}
Example:
<p>
In warm ocean waters around the world, you may see a strange sight: A fish
... | [
-0.4783270061016083,
-0.06633330881595612,
-1.5775624513626099,
-0.0770903080701828,
1.0555661916732788,
-1.653863787651062,
-0.5276665091514587,
1.7386456727981567,
0.1332268863916397,
0.7868322730064392,
-0.19320419430732727,
-0.9458834528923035,
-0.9782532453536987,
-0.23134705424308777... |
css/reference/selectors/_doublecolon_first-line/index.md | CSS - Selectors - ::first-line - Allowable properties:
Only a small subset of CSS properties can be used with the `::first-line` pseudo-element:
- All font-related properties: `font`, `font-kerning`, `font-style`, `font-variant`, `font-variant-numeric`, `font-variant-position`, `font-variant-east-asian`, `font-varian... | [
0.013015040196478367,
-0.0738641768693924,
-1.2482365369796753,
-0.15964780747890472,
0.577216625213623,
-1.648087978363037,
-0.5529160499572754,
1.8535364866256714,
0.19670787453651428,
0.29632872343063354,
0.3701465129852295,
-0.9962599873542786,
0.0787515640258789,
-0.27996426820755005,... |
css/reference/selectors/_doublecolon_first-line/index.md | CSS - Selectors - ::first-line - Syntax:
Example:
::first-line {
/* ... */
} | [
0.027369938790798187,
-0.7156080603599548,
-1.5966697931289673,
0.9298653602600098,
-0.5608277916908264,
-0.5076978206634521,
0.7973785400390625,
1.7155205011367798,
0.6431407928466797,
0.1615041047334671,
0.10980527102947235,
-0.23937882483005524,
-0.5102790594100952,
-0.9009593725204468,... |
css/reference/selectors/_doublecolon_first-line/index.md | CSS - Selectors - ::first-line - Examples - Styling first line of a paragraph - HTML:
Example:
<p>
Styles will only be applied to the first line of this paragraph. After that,
all text will be styled like normal. See what I mean?
</p>
<span>
The first line of this text will not receive special styling because ... | [
-0.6868595480918884,
0.4341934323310852,
-1.0262980461120605,
0.12143215537071228,
-0.21796758472919464,
-1.3965874910354614,
0.21212540566921234,
0.8817690014839172,
-0.6212565302848816,
-0.08896400779485703,
0.06455659866333008,
-0.7599238753318787,
-0.24466167390346527,
-0.5601616501808... |
css/reference/selectors/_doublecolon_first-line/index.md | CSS - Selectors - ::first-line - Examples - Styling first line of a paragraph - CSS:
Example:
* {
font-size: 20px;
font-family: sans-serif;
}
Example:
::first-line {
color: blue;
font-weight: bold;
/* WARNING: DO NOT USE THESE */
/* Many properties are invalid in ::first-line pseudo-elements */
margi... | [
-0.6205653548240662,
0.7845580577850342,
-1.09569251537323,
-0.6972641348838806,
0.3734487295150757,
-1.234704613685608,
0.33927085995674133,
1.4763081073760986,
-0.2946593463420868,
0.0664016529917717,
0.23150524497032166,
-1.046827793121338,
-0.05722987279295921,
-0.839141845703125,
-0... |
css/reference/selectors/_doublecolon_first-line/index.md | CSS - Selectors - ::first-line - Examples - Styling the first line of an SVG text element:
In this example, we style the first line of an SVG `text` element using the `::first-line` pseudo-element.
Note: At time of writing this feature has limited support. | [
-0.6054741144180298,
-0.26495668292045593,
-0.6700562238693237,
0.40533891320228577,
0.1017075628042221,
-0.737723708152771,
1.1125366687774658,
0.7352046966552734,
0.1225358247756958,
0.460863322019577,
-0.03484591841697693,
-0.9295350313186646,
-0.4799645245075226,
-1.1492568254470825,
... |
css/reference/selectors/_doublecolon_first-line/index.md | CSS - Selectors - ::first-line - Examples - Styling the first line of an SVG text element - HTML:
Example:
<svg viewBox="0 0 320 150">
<text y="20">Here is an English paragraph
that is broken into multiple lines
in the source code so that it can
be more easily read and edited
in a text editor.
</text>
</svg> | [
-0.6675844192504883,
-0.2119777947664261,
-0.2954614758491516,
0.3155553340911865,
0.2582607865333557,
-1.0716028213500977,
0.6868146657943726,
0.592472493648529,
-0.2255365252494812,
0.608603835105896,
0.1021675169467926,
-0.3448900282382965,
-0.5451936721801758,
-0.8803214430809021,
-1... |
css/reference/selectors/_doublecolon_first-line/index.md | CSS - Selectors - ::first-line - Examples - Styling the first line of an SVG text element - CSS:
In order to make the SVG `<text>` element wrap to multiple lines, we use the `white-space` CSS property. We then select the first line using the `::first-line` pseudo-element.
Example:
text {
font-size: 20px;
font-fa... | [
-0.5361996293067932,
0.1968337595462799,
-0.7325053811073303,
-0.13593026995658875,
0.66593998670578,
-1.2075196504592896,
-0.34988540410995483,
1.6744376420974731,
0.15463058650493622,
0.4173835515975952,
0.42829105257987976,
-0.6843039989471436,
-0.42177072167396545,
-0.2520395815372467,... |
css/reference/selectors/_colon_read-only/index.md | CSS - Selectors - :read-only:
The `:read-only` CSS pseudo-class selects elements (such as certain `input` types and `textarea`) that are not editable by the user. Elements on which the HTML attribute `readonly` doesn't have an effect (such as `<input type="radio">`, `<input type="checkbox">`, and all other non-form el... | [
-0.5112982392311096,
0.4760289192199707,
-1.3683463335037231,
-0.01259821467101574,
0.6460961699485779,
-2.083935499191284,
-0.673623263835907,
1.455937147140503,
-0.38574129343032837,
0.29703059792518616,
0.7377158403396606,
-0.5043715834617615,
-0.2568431496620178,
-0.5039894580841064,
... |
css/reference/selectors/_colon_read-only/index.md | CSS - Selectors - :read-only - Syntax:
Example:
:read-only {
/* ... */
} | [
0.003420079592615366,
0.6617122888565063,
-0.2809630036354065,
0.8067932724952698,
-1.0872167348861694,
-0.6517746448516846,
0.4978506565093994,
2.141972064971924,
0.1464158594608307,
-0.26992011070251465,
0.09005464613437653,
-0.8090974688529968,
-0.6488243937492371,
-0.7057983875274658,
... |
css/reference/selectors/_colon_read-only/index.md | CSS - Selectors - :read-only - Examples - Confirming form information using read-only or read-write controls:
One use of read-only form controls is to allow the user to check and verify information that they may have entered in an earlier form (for example, shipping details), while still being able to submit the infor... | [
-1.2008713483810425,
0.20797549188137054,
-0.28670400381088257,
-0.15293270349502563,
0.7051096558570862,
-1.3406286239624023,
0.40210169553756714,
1.8362246751785278,
-0.4985395073890686,
0.16186845302581787,
-0.045515887439250946,
-0.09841901063919067,
-0.1446564793586731,
-0.19923666119... |
css/reference/selectors/_colon_read-only/index.md | CSS - Selectors - :read-only - Examples - Styling read-only non-form controls:
This selector doesn't just select `input`/`textarea` elements — it will select any element that cannot be edited by the user.
Example:
<p contenteditable>This paragraph is editable; it is read-write.</p>
<p>This paragraph is not editable... | [
-0.1425815373659134,
0.38153722882270813,
-0.4103246033191681,
0.04708664119243622,
0.6403884291648865,
-0.9195048213005066,
-0.13682496547698975,
1.0323840379714966,
-0.04491334781050682,
0.0834645926952362,
0.5157161951065063,
-0.5043994784355164,
-0.14581598341464996,
-0.270163446664810... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child:
The `:nth-child()` CSS pseudo-class matches elements based on the indexes of the elements in the child list of their parents. In other words, the `:nth-child()` selector selects child elements according to their position among all the sibling elements within a parent element.
Example:
p... | [
-0.44227102398872375,
-0.1456032395362854,
-1.0953500270843506,
0.1158694177865982,
0.32900965213775635,
-1.3516961336135864,
-0.18620559573173523,
1.3461345434188843,
-0.28238070011138916,
0.5891550183296204,
0.47362542152404785,
0.3776610493659973,
-0.7251570820808411,
0.7303774952888489... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Syntax:
Example:
:nth-child([ <An+B> | even | odd ] [of <complex-selector-list>]?) {
/* ... */
} | [
-0.09800347685813904,
-0.2736930251121521,
-0.5169763565063477,
0.4693053364753723,
-0.7167705297470093,
-1.6327768564224243,
0.9368709921836853,
1.4177019596099854,
0.5583994388580322,
-0.02899710088968277,
0.5923124551773071,
0.09806160628795624,
-1.655552864074707,
0.09398588538169861,
... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Syntax - Parameters:
`:nth-child()` takes a single argument that describes a pattern for matching element indices in a list of siblings. Element indices are 1-based. | [
0.1448841243982315,
-0.5026456117630005,
-1.4403315782546997,
0.2472197711467743,
-0.5577479600906372,
-1.4938075542449951,
1.9707016944885254,
0.85947185754776,
0.09048701822757721,
0.0037270449101924896,
0.1068015843629837,
-0.20588813722133636,
-0.9624885320663452,
0.5402176380157471,
... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Syntax - Parameters - Keyword values:
- `odd`: Represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc.
- `even`: Represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc. | [
-0.2183895707130432,
-0.15008758008480072,
-1.0856847763061523,
-0.5926649570465088,
-0.7001772522926331,
-1.1090338230133057,
1.410189151763916,
0.9438973069190979,
0.3289647102355957,
0.2196686565876007,
-0.12205736339092255,
-0.06455820798873901,
-1.4054986238479614,
0.0798717737197876,... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Syntax - Parameters - Functional notation:
- `<An+B>`: Represents elements whose numeric position in a series of siblings matches the pattern `An+B`, for every positive integer or zero value of `n`, where: - `A` is an integer step size, - `B` is an integer offset, - `n` is all non-n... | [
-0.17058590054512024,
-0.877123236656189,
-1.1455594301223755,
0.9017037153244019,
-0.49877259135246277,
-0.31252649426460266,
1.720389723777771,
0.8158954977989197,
0.34180861711502075,
0.4704172611236572,
0.4185539484024048,
-0.03461717069149017,
-0.7625536918640137,
0.5014594197273254,
... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Syntax - Parameters - The `of <selector>` syntax:
By passing a selector argument, we can select the nth element that matches that selector. For example, the following selector matches the first three list items which have a `class="important"` set.
Example:
:nth-child(-n + 3 of li.impo... | [
-0.03986945375800133,
-0.33340439200401306,
-0.7983236312866211,
1.123594045639038,
-0.2858397662639618,
-1.0950721502304077,
1.0516382455825806,
0.6544578075408936,
0.077036052942276,
0.4401920735836029,
0.5553162693977356,
-0.07497499138116837,
-1.309004783630371,
0.5513495206832886,
-... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Examples - Example selectors:
- `tr:nth-child(odd)` or `tr:nth-child(2n+1)`: Represents the odd rows of an HTML table: 1, 3, 5, etc.
- `tr:nth-child(even)` or `tr:nth-child(2n)`: Represents the even rows of an HTML table: 2, 4, 6, etc.
- `:nth-child(7)`: Represents the seventh element.
-... | [
-0.12845022976398468,
0.014106670394539833,
-0.9828385710716248,
0.4089478552341461,
0.5024494528770447,
-1.1822597980499268,
0.3682057857513428,
0.9885456562042236,
-0.5713597536087036,
0.4768311679363251,
0.8078465461730957,
0.053849950432777405,
-1.1523873805999756,
0.8756124973297119,
... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Examples - Detailed example - HTML:
Example:
<h3>
<code>span:nth-child(2n+1)</code>, WITHOUT an <code><em></code> among
the child elements.
</h3>
<p>Children 1, 3, 5, and 7 are selected.</p>
<div class="first">
<span>Span 1!</span>
<span>Span 2</span>
<span>Span 3!</span... | [
-0.992300808429718,
-0.14388351142406464,
-0.8901382088661194,
0.23118925094604492,
0.47780394554138184,
-0.86563640832901,
0.3455982506275177,
1.1550182104110718,
-0.9630809426307678,
1.010631799697876,
0.7148776650428772,
0.5637901425361633,
-0.9696225523948669,
0.4963828921318054,
-1.... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Examples - Detailed example - CSS:
Example:
* {
font-family: sans-serif;
}
span,
div em {
padding: 5px;
border: 1px solid tomato;
display: inline-block;
margin-bottom: 3px;
}
Example:
.first span:nth-child(2n + 1),
.second span:nth-child(2n + 1),
.third span:nth-of-type(2n ... | [
-0.4974738657474518,
0.09483450651168823,
-0.09294303506612778,
-0.4347873330116272,
0.4692458510398865,
-0.36812421679496765,
0.19873814284801483,
1.2639148235321045,
-0.7486816644668579,
0.49033650755882263,
1.272782564163208,
-0.6538373827934265,
-0.8599246144294739,
0.3865431547164917,... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Examples - Using 'of <selector>':
In this example there is an unordered list of names, some of them have been marked as noted using `class="noted"`. These have been highlighted with a thick bottom border. | [
-0.19263063371181488,
-0.25557616353034973,
-0.9393166899681091,
0.7534379959106445,
-0.5463539361953735,
-0.4991205334663391,
1.3101730346679688,
1.1439355611801147,
0.17257627844810486,
0.42568668723106384,
0.7092938423156738,
0.1275656521320343,
-1.0090004205703735,
-0.06322728842496872... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Examples - Using 'of <selector>' - HTML:
Example:
<ul>
<li class="noted">Diego</li>
<li>Shilpa</li>
<li class="noted">Caterina</li>
<li>Jayla</li>
<li>Tyrone</li>
<li>Ricardo</li>
<li class="noted">Gila</li>
<li>Sienna</li>
<li>Titilayo</li>
<li class="noted">Lexi</l... | [
-1.4154369831085205,
-0.17291545867919922,
-0.6681734323501587,
0.17113573849201202,
0.408893883228302,
-0.3942151367664337,
0.472286581993103,
1.4487133026123047,
-0.24517211318016052,
0.3967982828617096,
0.8985475301742554,
-0.13386860489845276,
-0.5279544591903687,
0.2230098843574524,
... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Examples - Using 'of <selector>' - CSS:
Example:
* {
font-family: sans-serif;
}
ul {
display: flex;
flex-wrap: wrap;
list-style: none;
font-size: 1.2rem;
padding-left: 0;
}
li {
margin: 0.125rem;
padding: 0.25rem;
}
li {
border: 1px solid tomato;
}
.noted {
borde... | [
-0.30010879039764404,
0.5153529644012451,
-0.7235114574432373,
0.1282176673412323,
0.7081478834152222,
-1.1138882637023926,
-0.05306554585695267,
2.2274575233459473,
-0.6383770108222961,
0.6670265793800354,
1.1992380619049072,
0.013697691261768341,
-0.7804850935935974,
0.36355480551719666,... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Examples - of selector syntax vs selector nth-child:
In this example, there are two unordered lists of names. The first list shows the effect of `li:nth-child(-n + 3 of .noted)` and the second list shows the effect of `li.noted:nth-child(-n + 3)`. | [
-0.69266277551651,
-0.3839705288410187,
-1.1002119779586792,
0.5512318015098572,
-0.640313982963562,
-0.6968672871589661,
0.6920299530029297,
1.9639357328414917,
0.2179446816444397,
0.41496026515960693,
0.46773040294647217,
0.008311092853546143,
-1.5661166906356812,
-0.45772188901901245,
... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Examples - of selector syntax vs selector nth-child - HTML:
Example:
<ul class="one">
<li class="noted">Diego</li>
<li>Shilpa</li>
<li class="noted">Caterina</li>
<li>Jayla</li>
<li>Tyrone</li>
<li>Ricardo</li>
<li class="noted">Gila</li>
<li>Sienna</li>
<li>Titilayo</... | [
-2.0897598266601562,
-0.2551271319389343,
-0.6542679071426392,
0.4072345495223999,
0.17143875360488892,
-0.8586280941963196,
0.9916509389877319,
1.7496862411499023,
0.014954343438148499,
0.650532603263855,
0.44951024651527405,
0.016693323850631714,
-0.3256550133228302,
0.4841929078102112,
... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Examples - of selector syntax vs selector nth-child - CSS:
Example:
* {
font-family: sans-serif;
}
ul {
display: flex;
flex-wrap: wrap;
list-style: none;
font-size: 1.2rem;
padding-left: 0;
}
li {
margin: 0.125rem;
padding: 0.25rem;
}
li {
border: 1px solid tomato;
... | [
-0.8331202864646912,
0.5801668763160706,
-0.41141024231910706,
-0.2510465383529663,
0.5988718271255493,
-0.4513644874095917,
0.008356690406799316,
2.0446271896362305,
-0.6437298655509949,
0.3272373378276825,
1.2483739852905273,
-0.2512971758842468,
-0.404958575963974,
0.36429107189178467,
... |
css/reference/selectors/_colon_nth-child/index.md | CSS - Selectors - :nth-child - Examples - Using of selector to fix striped tables:
A common practice for tables is to use zebra-stripes which alternates between light and dark background colors for rows, making tables easier to read and more accessible. If a row is hidden, the stripes will appear merged and alter the ... | [
-0.3666784167289734,
-0.49514833092689514,
-1.1012916564941406,
0.7518916726112366,
-0.003264814615249634,
-0.9926384091377258,
1.499025821685791,
1.103790283203125,
0.4391099810600281,
0.6685549020767212,
0.08694012463092804,
0.18640755116939545,
-0.9167090058326721,
0.11997878551483154,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.