file stringlengths 16 94 | text stringlengths 32 24.4k | vector list |
|---|---|---|
javascript/reference/global_objects/weakref/index.md | JavaScript - Global Objects - WeakRef - Instance properties:
These properties are defined on `WeakRef.prototype` and shared by all `WeakRef` instances.
- `WeakRef.prototype.constructor` (optional): The constructor function that created the instance object. For `WeakRef` instances, the initial value is the `WeakRef` c... | [
-0.7095959782600403,
-0.10857405513525009,
-0.5186102390289307,
0.4382757842540741,
0.2580663859844208,
-1.8877485990524292,
1.0202621221542358,
1.196638822555542,
0.5789899826049805,
0.18435782194137573,
-1.3260869979858398,
0.3176446557044983,
-0.054895780980587006,
0.4202265441417694,
... |
javascript/reference/global_objects/weakref/index.md | JavaScript - Global Objects - WeakRef - Instance methods:
- `WeakRef.prototype.deref()`: Returns the `WeakRef` object's target object, or `undefined` if the target object has been reclaimed. | [
-0.37493324279785156,
0.36171045899391174,
-0.2036696970462799,
-0.7577558159828186,
-0.5056236982345581,
-1.063620686531067,
1.9077064990997314,
0.6089105606079102,
-0.16053475439548492,
0.2551936209201813,
-1.1351898908615112,
0.18131256103515625,
0.36139115691185,
0.6385497450828552,
... |
javascript/reference/global_objects/weakref/index.md | JavaScript - Global Objects - WeakRef - Examples - Using a WeakRef object:
This example starts a counter shown in a DOM element, stopping when the element doesn't exist anymore:
Example:
class Counter {
constructor(element) {
// Remember a weak reference to the DOM element
this.ref = new WeakRef(element);
... | [
-0.5726816058158875,
0.16242915391921997,
-0.5498659610748291,
0.12223567068576813,
-0.3504043519496918,
-1.4129265546798706,
1.5039725303649902,
1.2199628353118896,
0.05099654570221901,
0.7410163879394531,
-0.5681125521659851,
0.0142673309892416,
-0.15729044377803802,
0.7653317451477051,
... |
javascript/reference/global_objects/weakref/deref/index.md | JavaScript - Global Objects - WeakRef - deref:
The `deref()` method of `WeakRef` instances returns this `WeakRef`'s target value, or `undefined` if the target value has been garbage-collected. | [
-0.16033273935317993,
-0.13365431129932404,
-0.8215183615684509,
-0.35004276037216187,
-0.5647248029708862,
-1.7307323217391968,
1.7179464101791382,
0.416537880897522,
-0.6717862486839294,
0.6211774945259094,
-0.7844379544258118,
0.35076868534088135,
0.37894707918167114,
0.9126061201095581... |
javascript/reference/global_objects/weakref/deref/index.md | JavaScript - Global Objects - WeakRef - deref - Syntax:
Example:
deref() | [
0.024643274024128914,
0.20336437225341797,
-0.7613586187362671,
-1.0143831968307495,
-0.8123533129692078,
-1.7529064416885376,
1.4738330841064453,
1.3116592168807983,
0.04226349666714668,
-0.35100942850112915,
-1.0377697944641113,
-0.10214584320783615,
-0.15105848014354706,
0.6336629986763... |
javascript/reference/global_objects/weakref/deref/index.md | JavaScript - Global Objects - WeakRef - deref - Syntax - Parameters:
None. | [
-0.06622114032506943,
0.4224586486816406,
-0.950639545917511,
-1.182320475578308,
-0.5449576377868652,
-1.4550282955169678,
1.6132835149765015,
1.1677476167678833,
0.05773534998297691,
-0.34961187839508057,
-1.4658787250518799,
-0.40189674496650696,
-0.038567233830690384,
0.739840209484100... |
javascript/reference/global_objects/weakref/deref/index.md | JavaScript - Global Objects - WeakRef - deref - Syntax - Return value:
The target value of the WeakRef, which is either an object or a non-registered symbol. Returns `undefined` if the value has been garbage-collected. | [
-0.0026904817204922438,
0.3275619447231293,
-0.6741847395896912,
-0.43121859431266785,
-0.693653404712677,
-1.431734323501587,
1.5847629308700562,
0.7140297293663025,
0.1573040634393692,
0.5372428894042969,
-0.8992622494697571,
0.7118784785270691,
-0.12739711999893188,
0.6942788362503052,
... |
javascript/reference/global_objects/weakref/deref/index.md | JavaScript - Global Objects - WeakRef - deref - Description:
See the Notes on WeakRefs section of the `WeakRef` page for some important notes. | [
-0.4245341718196869,
0.004657363519072533,
-0.8729973435401917,
-0.5417110919952393,
-0.25302886962890625,
-2.0061185359954834,
1.0714447498321533,
0.7081572413444519,
0.1830015480518341,
0.4292990267276764,
-0.8082824349403381,
-0.21940045058727264,
0.13656044006347656,
0.9409275650978088... |
javascript/reference/global_objects/weakref/deref/index.md | JavaScript - Global Objects - WeakRef - deref - Examples - Using deref():
See the Examples section of the `WeakRef` page for the complete example.
Example:
const tick = () => {
// Get the element from the weak reference, if it still exists
const element = this.ref.deref();
if (element) {
element.textConten... | [
-0.4370587170124054,
-0.1551697552204132,
-0.4747931957244873,
0.005125109106302261,
-0.0367438904941082,
-1.8135937452316284,
1.883128046989441,
0.8475050330162048,
-0.04082581400871277,
0.4835924506187439,
-0.8044205904006958,
-0.2490745335817337,
-0.4609513580799103,
0.8203359842300415,... |
javascript/reference/global_objects/weakref/weakref/index.md | JavaScript - Global Objects - WeakRef:
The `WeakRef()` constructor creates `WeakRef` objects. | [
-0.8884919285774231,
0.3574977219104767,
-0.6002856492996216,
-0.08783014118671417,
-0.21475891768932343,
-1.7287793159484863,
0.6384118795394897,
1.452678918838501,
-0.45533275604248047,
0.41023069620132446,
-1.06954824924469,
-0.17257042229175568,
-0.2864079475402832,
0.6068306565284729,... |
javascript/reference/global_objects/weakref/weakref/index.md | JavaScript - Global Objects - WeakRef - Syntax:
Example:
new WeakRef(target)
Note: `WeakRef()` can only be constructed with `new`. Attempting to call it without `new` throws a `TypeError`. | [
-0.8745741248130798,
0.33042845129966736,
-0.17698918282985687,
-0.5902448296546936,
-0.2935364842414856,
-1.6473158597946167,
0.7614222168922424,
1.4306808710098267,
0.029466813430190086,
0.24876266717910767,
-0.5789533257484436,
-0.19490644335746765,
0.3542712330818176,
0.043818142265081... |
javascript/reference/global_objects/weakref/weakref/index.md | JavaScript - Global Objects - WeakRef - Syntax - Parameters:
- `target`: The target value the WeakRef should refer to (also called the referent). Must be an object or a non-registered symbol. | [
-0.4030532240867615,
0.2771264314651489,
-1.008914589881897,
-0.6694470643997192,
-0.5117994546890259,
-1.7496654987335205,
1.518298625946045,
0.5871261954307556,
0.422157883644104,
0.23518958687782288,
-1.2443435192108154,
0.41605404019355774,
-0.14813579618930817,
0.5061074495315552,
0... |
javascript/reference/global_objects/weakref/weakref/index.md | JavaScript - Global Objects - WeakRef - Syntax - Return value:
A new `WeakRef` object referring to the given target value. | [
-0.7124618887901306,
0.08154167979955673,
-0.8419529795646667,
-0.8426594734191895,
-0.38326171040534973,
-1.8467413187026978,
1.2108564376831055,
1.5296937227249146,
0.15908093750476837,
0.432586133480072,
-0.9616460800170898,
0.6669213175773621,
-0.2096085548400879,
1.5659633874893188,
... |
javascript/reference/global_objects/weakref/weakref/index.md | JavaScript - Global Objects - WeakRef - Syntax - Exceptions:
- `TypeError`: Thrown if `target` is not an object or a non-registered symbol. | [
-0.6244847178459167,
0.03178125619888306,
-0.6565133333206177,
-0.49909400939941406,
-0.6819518804550171,
-1.5117545127868652,
0.9774689078330994,
1.220921277999878,
-0.2599424123764038,
-0.05542721971869469,
-0.5812093019485474,
-0.34771010279655457,
-0.30626001954078674,
-0.6009843349456... |
javascript/reference/global_objects/weakref/weakref/index.md | JavaScript - Global Objects - WeakRef - Examples - Creating a new WeakRef object:
See the main `WeakRef` page for a complete example.
Example:
class Counter {
constructor(element) {
// Remember a weak reference to a DOM element
this.ref = new WeakRef(element);
this.start();
}
} | [
-0.6560438275337219,
0.21917285025119781,
-0.14440542459487915,
-0.026143917813897133,
-0.17839683592319489,
-2.0349807739257812,
1.3527841567993164,
1.57460355758667,
-0.17904488742351532,
0.2179328352212906,
-0.5272155404090881,
0.02987913228571415,
0.05240652710199356,
0.752081394195556... |
javascript/reference/global_objects/parsefloat/index.md | JavaScript - Global Objects - parseFloat:
The `parseFloat()` function parses a string argument and returns a floating point number.
Example:
function circumference(r) {
return parseFloat(r) * 2.0 * Math.PI;
}
console.log(circumference(4.567));
// Expected output: 28.695307297889173
console.log(circumference("4.5... | [
-2.2530853748321533,
-0.21367399394512177,
-0.9982543587684631,
0.031569160521030426,
0.30411142110824585,
-1.309383749961853,
-0.3082520663738251,
-0.45032382011413574,
-0.2729932963848114,
0.6807158589363098,
-0.3411530554294586,
-0.3437530994415283,
-0.10874675959348679,
0.5205556750297... |
javascript/reference/global_objects/parsefloat/index.md | JavaScript - Global Objects - parseFloat - Syntax:
Example:
parseFloat(string) | [
-1.560331106185913,
0.20871300995349884,
-0.9290362000465393,
-0.21836213767528534,
-0.46733638644218445,
-2.2658934593200684,
0.6564821600914001,
0.10705491155385971,
-0.40495023131370544,
-0.35993579030036926,
-0.002169306157156825,
-0.15077602863311768,
-0.31681251525878906,
0.226161092... |
javascript/reference/global_objects/parsefloat/index.md | JavaScript - Global Objects - parseFloat - Syntax - Parameters:
- `string`: The value to parse, coerced to a string. Leading `whitespace` in this argument is ignored. | [
-0.8639380931854248,
0.21770264208316803,
-0.7312644124031067,
-0.8790323734283447,
0.03829658403992653,
-2.0562760829925537,
0.9874536395072937,
0.2571122944355011,
0.4309506416320801,
0.27086496353149414,
-0.5552626848220825,
-0.0919937863945961,
-0.5245043635368347,
0.4945949614048004,
... |
javascript/reference/global_objects/parsefloat/index.md | JavaScript - Global Objects - parseFloat - Syntax - Return value:
A floating point number parsed from the given `string`, or `NaN` when the first non-whitespace character cannot be converted to a number.
Note: JavaScript does not have the distinction of "floating point numbers" and "integers" on the language level. `... | [
-1.0972830057144165,
-0.2220017910003662,
-0.3442494869232178,
-0.14362066984176636,
0.2123280018568039,
-0.7891941070556641,
1.1654953956604004,
0.5576819777488708,
-0.8486694693565369,
0.5689244866371155,
-0.5510919690132141,
0.2350417971611023,
-0.70242840051651,
0.31411266326904297,
... |
javascript/reference/global_objects/parsefloat/index.md | JavaScript - Global Objects - parseFloat - Description:
The `parseFloat` function converts its first argument to a string, parses that string as a decimal number literal, then returns a number or `NaN`. The number syntax it accepts can be summarized as:
- The characters accepted by `parseFloat()` are plus sign (`+`),... | [
0.20098750293254852,
-0.4408850073814392,
-0.7256501913070679,
-0.18282413482666016,
0.7663945555686951,
-0.7013257145881653,
0.3343508541584015,
-0.013244854286313057,
-0.4709852337837219,
0.30950814485549927,
-0.144387885928154,
-0.8015612363815308,
-0.7590733766555786,
0.691941797733306... |
javascript/reference/global_objects/parsefloat/index.md | JavaScript - Global Objects - parseFloat - Examples - Using parseFloat():
The following examples all return `3.14`:
Example:
parseFloat(3.14);
parseFloat("3.14");
parseFloat(" 3.14 ");
parseFloat("314e-2");
parseFloat("0.0314E+2");
parseFloat("3.14some non-digit characters");
parseFloat({
toString() {
return... | [
-1.7013463973999023,
0.255487859249115,
-0.9129474759101868,
-0.7367443442344666,
-0.05024021491408348,
-1.377220630645752,
0.832372784614563,
-0.24187235534191132,
-0.987800121307373,
-0.19101355969905853,
-0.24693793058395386,
0.7070573568344116,
0.2517194449901581,
-0.22464804351329803,... |
javascript/reference/global_objects/parsefloat/index.md | JavaScript - Global Objects - parseFloat - Examples - parseFloat() returning NaN:
The following example returns `NaN`:
Example:
parseFloat("FF2");
Anecdotally, because the string `NaN` itself is invalid syntax as accepted by `parseFloat()`, passing `"NaN"` returns `NaN` as well.
Example:
parseFloat("NaN"); // NaN | [
-1.572218656539917,
-0.17230239510536194,
-0.38192376494407654,
-0.16133351624011993,
-0.11326301842927933,
-1.6232261657714844,
0.9644889235496521,
0.15873479843139648,
-1.8240535259246826,
0.7441249489784241,
-0.40374037623405457,
-0.32821333408355713,
-0.2915009558200836,
-0.14501938223... |
javascript/reference/global_objects/parsefloat/index.md | JavaScript - Global Objects - parseFloat - Examples - Returning Infinity:
Infinity values are returned when the number is outside the double-precision 64-bit IEEE 754-2019 format range:
Example:
parseFloat("1.7976931348623159e+308"); // Infinity
parseFloat("-1.7976931348623159e+308"); // -Infinity
Infinity is also ... | [
-2.030949592590332,
0.3220057189464569,
-0.34148314595222473,
-0.14881369471549988,
-0.26743283867836,
-1.7013757228851318,
0.7559916973114014,
-0.1824342906475067,
-0.6622471809387207,
0.4281708300113678,
-0.07598462700843811,
0.17862190306186676,
0.17688605189323425,
0.020381920039653778... |
javascript/reference/global_objects/parsefloat/index.md | JavaScript - Global Objects - parseFloat - Examples - Interaction with BigInt values:
`parseFloat()` does not handle `BigInt` values. It stops at the `n` character, and treats the preceding string as a normal integer, with possible loss of precision. If a BigInt value is passed to `parseFloat()`, it will be converted ... | [
-1.6289565563201904,
0.15328846871852875,
-1.3072271347045898,
-0.35322362184524536,
0.2807493805885315,
-1.398957371711731,
0.3176230490207672,
-0.09645384550094604,
-1.0376899242401123,
-0.07708284258842468,
0.2285243421792984,
-0.4875562787055969,
-0.41392698884010315,
0.175683721899986... |
javascript/reference/global_objects/math/index.md | JavaScript - Global Objects - Math:
The `Math` namespace object contains static properties and methods for mathematical constants and functions.
`Math` works with the `Number` type. It doesn't work with `BigInt`. | [
-0.9868716597557068,
-0.45443394780158997,
-1.1971864700317383,
-0.0010559109505265951,
0.4074057936668396,
-1.8319636583328247,
0.3921845555305481,
0.687409520149231,
-0.08370348066091537,
-0.12194506824016571,
-1.1152279376983643,
0.3497450649738312,
0.8271003365516663,
-0.37114304304122... |
javascript/reference/global_objects/math/index.md | JavaScript - Global Objects - Math - Description:
Unlike most global objects, `Math` is not a constructor. You cannot use it with the `new` operator or invoke the `Math` object as a function. All properties and methods of `Math` are static.
Note: Many `Math` functions have a precision that's implementation-dependent.... | [
-0.699844479560852,
-0.4182688295841217,
-1.035188913345337,
0.2318129986524582,
-0.2549302577972412,
-2.3334152698516846,
-0.37773019075393677,
0.9095627069473267,
0.08894860744476318,
-0.26617783308029175,
-0.7973055243492126,
0.17566227912902832,
0.6226409077644348,
-0.41528192162513733... |
javascript/reference/global_objects/math/index.md | JavaScript - Global Objects - Math - Static properties:
- `Math.E`: Euler's number and the base of natural logarithms; approximately `2.718`.
- `Math.LN10`: Natural logarithm of `10`; approximately `2.303`.
- `Math.LN2`: Natural logarithm of `2`; approximately `0.693`.
- `Math.LOG10E`: Base-10 logarithm of `E`; approx... | [
-0.6494758725166321,
0.6409012675285339,
-0.22679585218429565,
-0.10944177210330963,
0.27637284994125366,
-0.16634006798267365,
-0.1295442134141922,
0.1540149450302124,
0.12930747866630554,
-0.5679062008857727,
-0.8178757429122925,
0.17733022570610046,
0.03933318704366684,
-0.1672312170267... |
javascript/reference/global_objects/math/index.md | JavaScript - Global Objects - Math - Static methods:
- `Math.abs()`: Returns the absolute value of the input.
- `Math.acos()`: Returns the arccosine of the input.
- `Math.acosh()`: Returns the hyperbolic arccosine of the input.
- `Math.asin()`: Returns the arcsine of the input.
- `Math.asinh()`: Returns the hyperbolic... | [
-0.32919415831565857,
0.5920542478561401,
-0.5948898196220398,
0.25337907671928406,
0.44032901525497437,
0.01582167111337185,
0.7652536034584045,
0.3670639991760254,
0.01560918428003788,
0.5538943409919739,
-1.2251837253570557,
-0.4074353277683258,
0.045672833919525146,
0.13113822042942047... |
javascript/reference/global_objects/math/index.md | JavaScript - Global Objects - Math - Examples - Converting between degrees and radians:
The trigonometric functions `sin()`, `cos()`, `tan()`, `asin()`, `acos()`, `atan()`, and `atan2()` expect (and return) angles in radians.
Since humans tend to think in degrees, and some functions (such as CSS transforms) can accep... | [
-0.4689330458641052,
0.7763749957084656,
-0.6917045712471008,
-0.7597843408584595,
-0.3907320499420166,
-0.6553053855895996,
0.07417115569114685,
-0.30436375737190247,
-0.07246943563222885,
0.40578845143318176,
0.2198386937379837,
0.3730766177177429,
-0.019281521439552307,
0.60933065414428... |
javascript/reference/global_objects/math/index.md | JavaScript - Global Objects - Math - Examples - Calculating the height of an equilateral triangle:
If we want to calculate the height of an equilateral triangle, and we know its side length is 100, we can use the formulae length of the adjacent multiplied by the tangent of the angle is equal to the opposite.
In JavaS... | [
-0.990414023399353,
0.5611897110939026,
-1.1003893613815308,
-0.33662158250808716,
-0.24128781259059906,
-1.04399836063385,
1.1603379249572754,
0.013332637026906013,
-0.25884005427360535,
0.675663948059082,
-1.0918585062026978,
1.1307276487350464,
-1.0336134433746338,
0.4847966730594635,
... |
javascript/reference/global_objects/math/index.md | JavaScript - Global Objects - Math - Examples - Returning a random integer between two bounds:
This can be achieved with a combination of `Math.random()` and `Math.floor()`:
Example:
function random(min, max) {
const num = Math.floor(Math.random() * (max - min + 1)) + min;
return num;
}
random(1, 10); | [
-0.9998542070388794,
0.20210951566696167,
-0.7415663599967957,
0.030185043811798096,
-0.5308558940887451,
0.715724766254425,
-0.16114307940006256,
0.1201411560177803,
-0.766817569732666,
0.2160407155752182,
-1.3231266736984253,
1.418934941291809,
-0.550993800163269,
0.26601508259773254,
... |
javascript/reference/global_objects/math/cbrt/index.md | JavaScript - Global Objects - Math - cbrt:
The `Math.cbrt()` static method returns the cube root of a number. That is
Example:
console.log(Math.cbrt(-1));
// Expected output: -1
console.log(Math.cbrt(1));
// Expected output: 1
console.log(Math.cbrt(Infinity));
// Expected output: Infinity
console.log(Math.cbrt(64... | [
-0.847950279712677,
0.17810246348381042,
-1.6827584505081177,
0.21743535995483398,
-0.039854127913713455,
-1.30392587184906,
0.3258415460586548,
0.007040390279144049,
0.046993549913167953,
-0.278232604265213,
-0.27137503027915955,
0.7376440763473511,
0.6145147085189819,
-0.1987175047397613... |
javascript/reference/global_objects/math/cbrt/index.md | JavaScript - Global Objects - Math - cbrt - Syntax:
Example:
Math.cbrt(x) | [
-0.3272656500339508,
0.7351496815681458,
-1.7061645984649658,
-0.6068307161331177,
-1.140095829963684,
-1.5645071268081665,
0.5411604046821594,
0.30040767788887024,
0.3552919626235962,
-1.0976823568344116,
-0.7673693299293518,
0.5239346027374268,
0.1603294312953949,
0.19081105291843414,
... |
javascript/reference/global_objects/math/cbrt/index.md | JavaScript - Global Objects - Math - cbrt - Syntax - Parameters:
- `x`: A number. | [
-0.060400426387786865,
-0.08599931001663208,
-2.1036226749420166,
-1.042989730834961,
-1.072340965270996,
-1.739427089691162,
0.5398666858673096,
0.20588967204093933,
0.6171634197235107,
-1.10822594165802,
-1.4033727645874023,
0.019758684560656548,
0.0936966985464096,
0.32293736934661865,
... |
javascript/reference/global_objects/math/cbrt/index.md | JavaScript - Global Objects - Math - cbrt - Syntax - Return value:
The cube root of `x`. | [
-0.1785077303647995,
1.0868635177612305,
-1.4691652059555054,
-0.5518932342529297,
-0.7418246269226074,
-1.0982621908187866,
0.9177892804145813,
-0.06952307373285294,
0.4489523470401764,
-0.8441575169563293,
-0.28780263662338257,
0.5141364336013794,
-0.08137772977352142,
0.7218952178955078... |
javascript/reference/global_objects/math/cbrt/index.md | JavaScript - Global Objects - Math - cbrt - Description:
Because `cbrt()` is a static method of `Math`, you always use it as `Math.cbrt()`, rather than as a method of a `Math` object you created (`Math` is not a constructor). | [
-0.69342041015625,
-0.007413373328745365,
-1.2554506063461304,
0.2182847112417221,
-0.23382335901260376,
-2.3565592765808105,
0.2741968035697937,
0.3906874656677246,
0.19129499793052673,
0.0971725583076477,
-0.7569653391838074,
0.3798767328262329,
0.8988885879516602,
0.01575622335076332,
... |
javascript/reference/global_objects/math/cbrt/index.md | JavaScript - Global Objects - Math - cbrt - Examples - Using Math.cbrt():
Example:
Math.cbrt(-Infinity); // -Infinity
Math.cbrt(-1); // -1
Math.cbrt(-0); // -0
Math.cbrt(0); // 0
Math.cbrt(1); // 1
Math.cbrt(2); // 1.2599210498948732
Math.cbrt(Infinity); // Infinity | [
-1.2577193975448608,
0.699400782585144,
-1.0543252229690552,
0.15088345110416412,
-0.4740815758705139,
-1.7585828304290771,
0.5748139023780823,
-0.566098690032959,
0.011736937798559666,
-0.7814937233924866,
-0.8152114748954773,
-0.008414671756327152,
0.45876115560531616,
-0.284411132335662... |
javascript/reference/global_objects/math/hypot/index.md | JavaScript - Global Objects - Math - hypot:
The `Math.hypot()` static method returns the square root of the sum of squares of its arguments. That is,
Example:
console.log(Math.hypot(3, 4));
// Expected output: 5
console.log(Math.hypot(5, 12));
// Expected output: 13
console.log(Math.hypot(3, 4, 5));
// Expected ou... | [
-0.9106497168540955,
-0.6412713527679443,
-1.4870661497116089,
-0.045328687876462936,
-0.23935681581497192,
-1.3710248470306396,
-0.00146677705924958,
0.5612385272979736,
0.06690012663602829,
-0.34503909945487976,
-0.8066861629486084,
1.4809690713882446,
0.4087405502796173,
-0.317292213439... |
javascript/reference/global_objects/math/hypot/index.md | JavaScript - Global Objects - Math - hypot - Syntax:
Example:
Math.hypot()
Math.hypot(value1)
Math.hypot(value1, value2)
Math.hypot(value1, value2, /* …, */ valueN) | [
-0.07942824810743332,
0.4894154369831085,
-0.24138806760311127,
0.05837450549006462,
-0.7172728180885315,
-1.839490532875061,
0.15617574751377106,
1.321342945098877,
0.13479234278202057,
-0.9797884225845337,
-1.004300832748413,
0.970649003982544,
0.2570045292377472,
-0.34162116050720215,
... |
javascript/reference/global_objects/math/hypot/index.md | JavaScript - Global Objects - Math - hypot - Syntax - Parameters:
- `value1`, …, `valueN`: Numbers. | [
0.586654543876648,
0.3378651440143585,
-0.7817258834838867,
-0.2353019416332245,
-0.502147376537323,
-1.8563562631607056,
0.5767850279808044,
0.7146472930908203,
0.0441804938018322,
-0.8707165122032166,
-1.2564064264297485,
0.40503522753715515,
-0.2880915403366089,
-0.05719657987356186,
... |
javascript/reference/global_objects/math/hypot/index.md | JavaScript - Global Objects - Math - hypot - Syntax - Return value:
The square root of the sum of squares of the given arguments. Returns `Infinity` if any of the arguments is ±Infinity. Otherwise, if at least one of the arguments is or is converted to `NaN`, returns `NaN`. Returns `0` if no arguments are given or all... | [
-1.1016974449157715,
0.20754076540470123,
-0.4051494598388672,
0.105736143887043,
-0.6565284729003906,
-1.5757970809936523,
0.9685197472572327,
-0.07998650521039963,
0.21356287598609924,
0.016863055527210236,
-0.9552745223045349,
1.4591307640075684,
-0.16572237014770508,
-0.027614578604698... |
javascript/reference/global_objects/math/hypot/index.md | JavaScript - Global Objects - Math - hypot - Description:
Calculating the hypotenuse of a right triangle, or the magnitude of a complex number, uses the formula `Math.sqrt(v1*v1 + v2*v2)`, where v1 and v2 are the lengths of the triangle's legs, or the complex number's real and complex components. The corresponding dis... | [
-0.6434100270271301,
0.5994821190834045,
-0.6674286723136902,
0.5390565991401672,
0.7142941951751709,
-0.8461955189704895,
0.43253642320632935,
0.20242418348789215,
0.026367295533418655,
0.42585474252700806,
-1.5229883193969727,
0.600089967250824,
0.01093169767409563,
0.21309484541416168,
... |
javascript/reference/global_objects/math/hypot/index.md | JavaScript - Global Objects - Math - hypot - Examples - Using Math.hypot():
Example:
Math.hypot(3, 4); // 5
Math.hypot(3, 4, 5); // 7.0710678118654755
Math.hypot(); // 0
Math.hypot(NaN); // NaN
Math.hypot(NaN, Infinity); // Infinity
Math.hypot(3, 4, "foo"); // NaN, since +'foo' => NaN
Math.hypot(3, 4, "5"); // 7.0710... | [
-0.4326809346675873,
-0.0009257863857783377,
-0.310994029045105,
0.12683948874473572,
-0.42968517541885376,
-1.8114211559295654,
0.7762376070022583,
0.06690119951963425,
-0.3362026810646057,
-0.3320227861404419,
-1.3638339042663574,
0.5059001445770264,
0.3489709496498108,
-0.71485471725463... |
javascript/reference/global_objects/math/e/index.md | JavaScript - Global Objects - Math - E:
The `Math.E` static data property represents Euler's number, the base of natural logarithms, e, which is approximately 2.718.
Example:
function compoundOneYear(interestRate, currentVal) {
return currentVal * Math.E ** interestRate;
}
console.log(Math.E);
// Expected output:... | [
-0.7081738114356995,
-0.05115194618701935,
-1.4698431491851807,
-0.006767319981008768,
-0.11826106160879135,
-1.9238502979278564,
-1.444791316986084,
0.6817882657051086,
-0.11069393903017044,
0.3575843572616577,
-0.5697145462036133,
0.6505007743835449,
-0.09136995673179626,
-0.948293626308... |
javascript/reference/global_objects/math/e/index.md | JavaScript - Global Objects - Math - E - Description:
Because `E` is a static property of `Math`, you always use it as `Math.E`, rather than as a property of a `Math` object you created (`Math` is not a constructor). | [
-0.8336477279663086,
-0.4388483464717865,
-0.4968688189983368,
0.4031302332878113,
0.03121025674045086,
-3.0273842811584473,
-0.497178316116333,
1.5155457258224487,
0.05746297910809517,
0.46862927079200745,
-0.8889448642730713,
0.6003655791282654,
0.5455076098442078,
-0.6609472632408142,
... |
javascript/reference/global_objects/math/e/index.md | JavaScript - Global Objects - Math - E - Examples - Using Math.E:
The following function returns e:
Example:
function getNapier() {
return Math.E;
}
getNapier(); // 2.718281828459045 | [
-1.3740780353546143,
-0.09221801906824112,
-0.7361938953399658,
0.15598070621490479,
-0.9519050717353821,
-1.1788183450698853,
-0.31024235486984253,
0.6041999459266663,
-1.172499656677246,
0.4654442071914673,
-0.6051680445671082,
0.6192601919174194,
-0.48726195096969604,
-0.633350908756256... |
javascript/reference/global_objects/math/tan/index.md | JavaScript - Global Objects - Math - tan:
The `Math.tan()` static method returns the tangent of a number in radians.
Example:
function getTanFromDegrees(degrees) {
return Math.tan((degrees * Math.PI) / 180);
}
console.log(getTanFromDegrees(0));
// Expected output: 0
console.log(getTanFromDegrees(45));
// Expecte... | [
-0.7876527905464172,
0.09715171158313751,
-1.1722451448440552,
-0.7588474154472351,
-0.31661278009414673,
-0.6874697804450989,
-0.007259550970047712,
0.7039013504981995,
-0.4495563805103302,
0.9485911726951599,
-0.8063836693763733,
0.6567318439483643,
-0.09757014364004135,
0.63199031352996... |
javascript/reference/global_objects/math/tan/index.md | JavaScript - Global Objects - Math - tan - Syntax:
Example:
Math.tan(x) | [
0.07548302412033081,
0.6552307605743408,
-1.1706541776657104,
-0.7335751056671143,
-1.0195802450180054,
-1.454765796661377,
0.41936418414115906,
1.4849165678024292,
-0.1861966997385025,
-0.1363649070262909,
-0.6460527777671814,
0.438233882188797,
-0.7056146264076233,
0.2850341796875,
0.2... |
javascript/reference/global_objects/math/tan/index.md | JavaScript - Global Objects - Math - tan - Syntax - Parameters:
- `x`: A number representing an angle in radians. | [
-0.2223551869392395,
0.32863667607307434,
-1.6217806339263916,
-0.8181236982345581,
-1.0798888206481934,
-1.3268922567367554,
0.43060368299484253,
0.8082562685012817,
0.06741403043270111,
0.02087963931262493,
-1.0490446090698242,
-0.23094263672828674,
-0.39022183418273926,
0.74178510904312... |
javascript/reference/global_objects/math/tan/index.md | JavaScript - Global Objects - Math - tan - Syntax - Return value:
The tangent of `x`. If `x` is `Infinity`, `-Infinity`, or `NaN`, returns `NaN`.
Note: Due to floating point precision, it's not possible to obtain the exact value π/2, so the result is always finite if not `NaN`. | [
-1.2847838401794434,
0.5363731980323792,
-0.7362348437309265,
-0.12402872741222382,
-0.8400173187255859,
-0.765285313129425,
0.9182385206222534,
0.8650134801864624,
-0.33162999153137207,
0.6838567852973938,
-0.697945773601532,
0.6607905626296997,
-0.16410160064697266,
0.7032160758972168,
... |
javascript/reference/global_objects/math/tan/index.md | JavaScript - Global Objects - Math - tan - Description:
Because `tan()` is a static method of `Math`, you always use it as `Math.tan()`, rather than as a method of a `Math` object you created (`Math` is not a constructor). | [
-0.3725406527519226,
-0.012186073698103428,
-0.9327868223190308,
0.11000699549913406,
-0.28430354595184326,
-2.4366908073425293,
0.06949052959680557,
1.455238938331604,
-0.23453585803508759,
0.8574643135070801,
-1.0108314752578735,
0.45471855998039246,
0.07271728664636612,
0.03177772089838... |
javascript/reference/global_objects/math/tan/index.md | JavaScript - Global Objects - Math - tan - Examples - Using Math.tan():
Example:
Math.tan(-Infinity); // NaN
Math.tan(-0); // -0
Math.tan(0); // 0
Math.tan(1); // 1.5574077246549023
Math.tan(Math.PI / 4); // 0.9999999999999999 (Floating point error)
Math.tan(Infinity); // NaN | [
-1.4857008457183838,
0.5278883576393127,
-0.734184980392456,
-0.0110072186216712,
-0.22204247117042542,
-1.1901835203170776,
0.6753368377685547,
0.10417880117893219,
-0.7996041774749756,
0.35987934470176697,
-1.014093279838562,
-0.05230942741036415,
0.2151920348405838,
-0.08963030576705933... |
javascript/reference/global_objects/math/tan/index.md | JavaScript - Global Objects - Math - tan - Examples - Math.tan() and π/2:
It's not possible to calculate `tan(π/2)` exactly.
Example:
Math.tan(Math.PI / 2); // 16331239353195370
Math.tan(Math.PI / 2 + Number.EPSILON); // -6218431163823738 | [
-0.9494292140007019,
1.0098830461502075,
-0.8366283178329468,
-0.06090904772281647,
-0.6413070559501648,
-1.5166503190994263,
-0.03145178407430649,
0.3612556457519531,
-0.10254523158073425,
0.4624442160129547,
-0.8012650012969971,
0.6517634987831116,
-0.5044732689857483,
0.0983188822865486... |
javascript/reference/global_objects/math/tan/index.md | JavaScript - Global Objects - Math - tan - Examples - Using Math.tan() with a degree value:
Because the `Math.tan()` function accepts radians, but it is often easier to work with degrees, the following function accepts a value in degrees, converts it to radians and returns the tangent.
Example:
function getTanDeg(de... | [
-0.700828492641449,
0.20636358857154846,
-0.9558572173118591,
-0.7559474110603333,
-0.2834349572658539,
-0.7776991128921509,
-0.02305678091943264,
0.35212746262550354,
0.13332712650299072,
0.40933865308761597,
-0.5193421244621277,
0.43870335817337036,
-0.09669217467308044,
0.33372202515602... |
javascript/reference/global_objects/math/sinh/index.md | JavaScript - Global Objects - Math - sinh:
The `Math.sinh()` static method returns the hyperbolic sine of a number. That is,
Example:
console.log(Math.sinh(0));
// Expected output: 0
console.log(Math.sinh(1));
// Expected output: 1.1752011936438014
console.log(Math.sinh(-1));
// Expected output: -1.175201193643801... | [
-1.0914859771728516,
-0.7466960549354553,
-0.7978641390800476,
0.04825914278626442,
0.2804625332355499,
-1.0243746042251587,
0.3587409555912018,
1.0446170568466187,
-0.3963226079940796,
1.0909299850463867,
-0.281482458114624,
1.0063410997390747,
0.5922352075576782,
0.2133818417787552,
-0... |
javascript/reference/global_objects/math/sinh/index.md | JavaScript - Global Objects - Math - sinh - Syntax:
Example:
Math.sinh(x) | [
-0.021524231880903244,
-0.06619628518819809,
-0.7376025915145874,
-0.7980215549468994,
-0.9464206695556641,
-1.2791320085525513,
0.6583039164543152,
1.2371256351470947,
-0.17045877873897552,
0.08952464163303375,
-0.2160947024822235,
0.7389883399009705,
-0.07254178076982498,
0.3231991827487... |
javascript/reference/global_objects/math/sinh/index.md | JavaScript - Global Objects - Math - sinh - Syntax - Parameters:
- `x`: A number. | [
0.16513046622276306,
-0.4944106340408325,
-1.4479937553405762,
-1.4356273412704468,
-0.9790252447128296,
-1.2559670209884644,
0.6344696283340454,
1.0536102056503296,
0.32314571738243103,
-0.5344836711883545,
-1.0548913478851318,
0.3539202809333801,
-0.22343873977661133,
0.2729955315589905,... |
javascript/reference/global_objects/math/sinh/index.md | JavaScript - Global Objects - Math - sinh - Syntax - Return value:
The hyperbolic sine of `x`. | [
-0.6035690307617188,
0.18231689929962158,
-0.6014915108680725,
-0.39282315969467163,
-0.40875300765037537,
-0.8366904258728027,
0.9873372316360474,
0.8389374613761902,
0.2058030515909195,
0.3169722259044647,
-0.5308697819709778,
0.5120696425437927,
0.034604378044605255,
0.9801446199417114,... |
javascript/reference/global_objects/math/sinh/index.md | JavaScript - Global Objects - Math - sinh - Description:
Because `sinh()` is a static method of `Math`, you always use it as `Math.sinh()`, rather than as a method of a `Math` object you created (`Math` is not a constructor). | [
-0.5020230412483215,
-0.7509625554084778,
-0.3827463388442993,
0.10621758550405502,
-0.06958380341529846,
-2.0583596229553223,
0.4300430715084076,
1.219319224357605,
-0.12796002626419067,
1.1167742013931274,
-0.36382386088371277,
0.702946126461029,
0.787542998790741,
0.15944074094295502,
... |
javascript/reference/global_objects/math/sinh/index.md | JavaScript - Global Objects - Math - sinh - Examples - Using Math.sinh():
Example:
Math.sinh(-Infinity); // -Infinity
Math.sinh(-0); // -0
Math.sinh(0); // 0
Math.sinh(1); // 1.1752011936438014
Math.sinh(Infinity); // Infinity | [
-1.0838109254837036,
0.1539599597454071,
-0.1233634203672409,
0.0786285549402237,
-0.3735465109348297,
-1.2931807041168213,
0.8035330176353455,
0.4954553544521332,
-0.12920589745044708,
0.14109349250793457,
-0.32239052653312683,
0.3151564300060272,
0.556811511516571,
-0.16502432525157928,
... |
javascript/reference/global_objects/math/round/index.md | JavaScript - Global Objects - Math - round:
The `Math.round()` static method returns the value of a number rounded to the nearest integer.
Example:
console.log(Math.round(0.9));
// Expected output: 1
console.log(Math.round(5.95), Math.round(5.5), Math.round(5.05));
// Expected output: 6 6 5
console.log(Math.round(... | [
-0.8131402730941772,
0.14559747278690338,
-0.946269690990448,
-0.09639747440814972,
-0.24764546751976013,
-0.6568480134010315,
-0.20965084433555603,
0.5198272466659546,
-0.151585653424263,
0.4052509069442749,
-0.8381590843200684,
0.7616457343101501,
-0.22444841265678406,
0.2264147996902465... |
javascript/reference/global_objects/math/round/index.md | JavaScript - Global Objects - Math - round - Syntax:
Example:
Math.round(x) | [
-0.2567141056060791,
1.0028663873672485,
-0.7833191752433777,
-0.7096065878868103,
-1.0981218814849854,
-1.2950958013534546,
0.31458866596221924,
0.9408293962478638,
-0.14928944408893585,
-0.8427124619483948,
-0.6984946131706238,
0.5908553004264832,
-0.5868632793426514,
-0.1094794571399688... |
javascript/reference/global_objects/math/round/index.md | JavaScript - Global Objects - Math - round - Syntax - Parameters:
- `x`: A number. | [
-0.32363802194595337,
0.23288089036941528,
-1.4252893924713135,
-1.08808434009552,
-1.0260770320892334,
-1.2304378747940063,
0.4366111159324646,
0.610850989818573,
0.3722631335258484,
-0.807303786277771,
-1.1228008270263672,
0.13434137403964996,
-0.4635860025882721,
0.2188117802143097,
0... |
javascript/reference/global_objects/math/round/index.md | JavaScript - Global Objects - Math - round - Syntax - Return value:
The value of `x` rounded to the nearest integer. | [
-0.7949677109718323,
1.0578970909118652,
-0.5489517450332642,
-0.5196806788444519,
-1.0211284160614014,
-0.649738073348999,
0.8302366733551025,
0.47504571080207825,
0.06367047131061554,
-0.1419471800327301,
-0.8882250785827637,
0.7010681629180908,
-0.44632306694984436,
0.9615893959999084,
... |
javascript/reference/global_objects/math/round/index.md | JavaScript - Global Objects - Math - round - Description:
If the fractional portion of the argument is greater than 0.5, the argument is rounded to the integer with the next higher absolute value. If it is less than 0.5, the argument is rounded to the integer with the lower absolute value. If the fractional portion is... | [
-1.1811221837997437,
0.33122944831848145,
0.0858563631772995,
0.3858587145805359,
-0.278388112783432,
-1.198506474494934,
0.8582468628883362,
0.7445421814918518,
0.04766976833343506,
0.5581554174423218,
-1.0791471004486084,
-0.002707670908421278,
-1.0006260871887207,
0.684999942779541,
0... |
javascript/reference/global_objects/math/round/index.md | JavaScript - Global Objects - Math - round - Examples - Using round:
Example:
Math.round(-Infinity); // -Infinity
Math.round(-20.51); // -21
Math.round(-20.5); // -20
Math.round(-0.1); // -0
Math.round(0); // 0
Math.round(20.49); // 20
Math.round(20.5); // 21
Math.round(42); // 42
Math.round(Infinity); // Infinity | [
-0.800406813621521,
1.1481314897537231,
-0.2769314646720886,
-0.303129643201828,
-0.9708454608917236,
-1.516025185585022,
0.29033970832824707,
-0.027046917006373405,
-0.05031510815024376,
-0.45709267258644104,
-0.8522769212722778,
0.6608416438102722,
-0.1893104761838913,
-0.662930965423584... |
javascript/reference/global_objects/math/min/index.md | JavaScript - Global Objects - Math - min:
The `Math.min()` static method returns the smallest of the numbers given as input parameters, or `Infinity` if there are no parameters.
Example:
console.log(Math.min(2, 3, 1));
// Expected output: 1
console.log(Math.min(-2, -3, -1));
// Expected output: -3
const array = [2... | [
-0.970879316329956,
0.02153402753174305,
-1.454751968383789,
0.10240240395069122,
0.20904888212680817,
-0.891433596611023,
0.20285822451114655,
0.4068089425563812,
-0.26708218455314636,
0.3592664897441864,
-0.8816167712211609,
0.8386639952659607,
1.04778254032135,
-0.4350971579551697,
-0... |
javascript/reference/global_objects/math/min/index.md | JavaScript - Global Objects - Math - min - Syntax:
Example:
Math.min()
Math.min(value1)
Math.min(value1, value2)
Math.min(value1, value2, /* …, */ valueN) | [
-0.013128692284226418,
0.595544695854187,
-0.44848766922950745,
-0.06709649413824081,
-0.3216134309768677,
-1.2785364389419556,
-0.1884687840938568,
1.2166754007339478,
-0.4883660674095154,
-0.37928757071495056,
-0.8099111318588257,
0.5136758685112,
-0.2354286164045334,
-0.0689800530672073... |
javascript/reference/global_objects/math/min/index.md | JavaScript - Global Objects - Math - min - Syntax - Parameters:
- `value1`, …, `valueN`: Zero or more numbers among which the lowest value will be selected and returned. | [
-0.2521851062774658,
0.411878764629364,
-0.7920631766319275,
-0.06684718281030655,
-0.3248178958892822,
-0.8292093873023987,
0.41854506731033325,
0.8627150654792786,
-0.7551960945129395,
-0.14994007349014282,
-1.4113306999206543,
0.3560657501220703,
-0.19684384763240814,
0.1633754074573516... |
javascript/reference/global_objects/math/min/index.md | JavaScript - Global Objects - Math - min - Syntax - Return value:
The smallest of the given numbers. Returns `NaN` if any of the parameters is or is converted into `NaN`. Returns `Infinity` if no parameters are provided. | [
-1.1409330368041992,
0.6276705265045166,
-0.5508381128311157,
-0.20871493220329285,
-0.990791916847229,
-0.747245192527771,
1.0363763570785522,
-0.15631447732448578,
-0.46890249848365784,
0.6743842363357544,
-1.4273412227630615,
0.7495080232620239,
0.34917575120925903,
0.43309658765792847,... |
javascript/reference/global_objects/math/min/index.md | JavaScript - Global Objects - Math - min - Description:
Because `min()` is a static method of `Math`, you always use it as `Math.min()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).
`Math.min.length` is 2, which weakly signals that it's designed to handle at least two paramete... | [
-0.9887793660163879,
-0.24994724988937378,
-1.0321465730667114,
0.19768419861793518,
0.12482298910617828,
-1.9259709119796753,
-0.2993786633014679,
0.885857343673706,
-0.7790162563323975,
0.3961983025074005,
-1.4901483058929443,
0.782653272151947,
0.4283588230609894,
-0.34810030460357666,
... |
javascript/reference/global_objects/math/min/index.md | JavaScript - Global Objects - Math - min - Examples - Using Math.min():
This finds the min of `x` and `y` and assigns it to `z`:
Example:
const x = 10;
const y = -20;
const z = Math.min(x, y); // -20 | [
-0.920172393321991,
0.36552703380584717,
-1.133911371231079,
0.4171680808067322,
0.0022887468803673983,
-0.42484408617019653,
0.5631561875343323,
-0.2709140181541443,
-0.14458884298801422,
0.14541226625442505,
-1.299352765083313,
0.8251139521598816,
-0.6801151633262634,
0.35475146770477295... |
javascript/reference/global_objects/math/min/index.md | JavaScript - Global Objects - Math - min - Examples - Clipping a value with Math.min():
`Math.min()` is often used to clip a value so that it is always less than or equal to a boundary. For instance, this
Example:
let x = f(foo);
if (x > boundary) {
x = boundary;
}
may be written as this
Example:
const x = Mat... | [
-1.6678051948547363,
-0.007941953837871552,
-1.0418384075164795,
-0.22413775324821472,
0.13117094337940216,
-0.9314805269241333,
0.4137200713157654,
0.9630940556526184,
-0.21670566499233246,
0.31380558013916016,
-0.9262673854827881,
0.5253223776817322,
0.08293147385120392,
-0.1579918712377... |
javascript/reference/global_objects/math/sign/index.md | JavaScript - Global Objects - Math - sign:
The `Math.sign()` static method returns 1 or -1, indicating the sign of the number passed as argument. If the input is 0 or -0, it will be returned as-is.
Example:
console.log(Math.sign(3));
// Expected output: 1
console.log(Math.sign(-3));
// Expected output: -1
console.... | [
-1.1061444282531738,
-0.30459555983543396,
-1.379559874534607,
-0.6278612613677979,
0.33444851636886597,
-1.6346197128295898,
0.16411878168582916,
1.6078948974609375,
-0.4462911784648895,
0.3795505166053772,
-0.1535876840353012,
0.4338224232196808,
1.0066112279891968,
-0.257543683052063,
... |
javascript/reference/global_objects/math/sign/index.md | JavaScript - Global Objects - Math - sign - Syntax:
Example:
Math.sign(x) | [
-0.48268768191337585,
0.21611562371253967,
-1.237699031829834,
-1.1017498970031738,
-0.7808576226234436,
-1.6122912168502808,
0.32920941710472107,
1.6304188966751099,
-0.17411580681800842,
-0.8129649758338928,
-0.009156066924333572,
0.6760001182556152,
0.2824982702732086,
-0.20701804757118... |
javascript/reference/global_objects/math/sign/index.md | JavaScript - Global Objects - Math - sign - Syntax - Parameters:
- `x`: A number. | [
-0.02008771523833275,
-0.17423851788043976,
-1.7444827556610107,
-1.3491032123565674,
-0.9140263795852661,
-1.5441842079162598,
0.3400849997997284,
1.1003257036209106,
0.2485380470752716,
-0.9560756683349609,
-0.9411131143569946,
0.18975505232810974,
0.08926516771316528,
0.1470064818859100... |
javascript/reference/global_objects/math/sign/index.md | JavaScript - Global Objects - Math - sign - Syntax - Return value:
A number representing the sign of `x`:
- If `x` is positive, returns `1`.
- If `x` is negative, returns `-1`.
- If `x` is positive zero, returns `0`.
- If `x` is negative zero, returns `-0`.
- Otherwise, returns `NaN`. | [
-1.2013673782348633,
0.1522413045167923,
-1.0313950777053833,
-0.334526389837265,
-0.4243300259113312,
-1.3753628730773926,
1.1600501537322998,
1.0603843927383423,
-0.48149189352989197,
0.2174748033285141,
-0.723257839679718,
0.31832730770111084,
-0.10689982026815414,
0.2544650137424469,
... |
javascript/reference/global_objects/math/sign/index.md | JavaScript - Global Objects - Math - sign - Description:
Because `sign()` is a static method of `Math`, you always use it as `Math.sign()`, rather than as a method of a `Math` object you created (`Math` is not a constructor). | [
-0.7941117286682129,
-0.07852990180253983,
-0.9361628890037537,
-0.4456298053264618,
-0.10516199469566345,
-2.3829097747802734,
-0.06055522337555885,
1.5641813278198242,
-0.15447430312633514,
0.16511468589305878,
-0.2403011918067932,
0.718488872051239,
0.9484871029853821,
-0.34600332379341... |
javascript/reference/global_objects/math/sign/index.md | JavaScript - Global Objects - Math - sign - Examples - Using Math.sign():
Example:
Math.sign(3); // 1
Math.sign(-3); // -1
Math.sign("-3"); // -1
Math.sign(0); // 0
Math.sign(-0); // -0
Math.sign(NaN); // NaN
Math.sign("foo"); // NaN
Math.sign(); // NaN | [
-0.6733630895614624,
-0.06175043433904648,
-0.9326373934745789,
-0.7722193598747253,
0.09542019665241241,
-1.2431824207305908,
0.7899124026298523,
1.2436867952346802,
-0.9939157962799072,
-0.05020977184176445,
-0.49537643790245056,
0.648634135723114,
0.4488910436630249,
-1.0593454837799072... |
javascript/reference/global_objects/math/sumprecise/index.md | JavaScript - Global Objects - Math - sumPrecise:
The `Math.sumPrecise()` static method takes an iterable of numbers and returns the sum of them. It is more precise than summing them up in a loop, because it avoids floating point precision loss in intermediate results.
Example:
console.log(Math.sumPrecise([1, 2]));
/... | [
-0.815601110458374,
-0.39666181802749634,
-1.5430153608322144,
-0.09507783502340317,
0.3011311888694763,
-1.1983094215393066,
0.2052324265241623,
0.653643786907196,
-0.3938555121421814,
0.9445800185203552,
-0.811066210269928,
1.0610721111297607,
0.4088846743106842,
-0.5282512903213501,
-... |
javascript/reference/global_objects/math/sumprecise/index.md | JavaScript - Global Objects - Math - sumPrecise - Syntax:
Example:
Math.sumPrecise(numbers) | [
-0.2753063142299652,
0.3265667259693146,
-0.7889045476913452,
-0.6532474160194397,
-0.6417221426963806,
-1.7640033960342407,
0.6397064328193665,
0.7250946164131165,
-0.24516162276268005,
-0.025669215247035027,
-0.7294188737869263,
0.8785001039505005,
0.14787167310714722,
-0.546050965785980... |
javascript/reference/global_objects/math/sumprecise/index.md | JavaScript - Global Objects - Math - sumPrecise - Syntax - Parameters:
- `numbers`: An iterable (such as an `Array`) of numbers. | [
0.2691267132759094,
0.0033768650609999895,
-0.8274269104003906,
-0.44198259711265564,
-0.2743665277957916,
-1.296920895576477,
0.49518999457359314,
0.6452502608299255,
-0.20547614991664886,
0.3289615213871002,
-1.4929991960525513,
0.7409712672233582,
-0.30847662687301636,
-0.00306407082825... |
javascript/reference/global_objects/math/sumprecise/index.md | JavaScript - Global Objects - Math - sumPrecise - Syntax - Return value:
A number that is the sum of the numbers in the `numbers` iterable. If the iterable is empty, the return value is `-0` (not `0`). | [
-0.41835349798202515,
0.4191184937953949,
-0.3087182641029358,
-0.24891157448291779,
-0.1987258791923523,
-1.0161501169204712,
0.8316454887390137,
0.9730933904647827,
-0.3467099964618683,
0.6156827211380005,
-0.8915718197822571,
1.2241560220718384,
-0.07357007265090942,
0.04790886119008064... |
javascript/reference/global_objects/math/sumprecise/index.md | JavaScript - Global Objects - Math - sumPrecise - Syntax - Exceptions:
- `TypeError`: If `numbers` is not an iterable, or if any of the numbers in the iterable is not of the number type. | [
-0.5722761750221252,
0.013418910093605518,
-0.1928424835205078,
-0.25769907236099243,
-0.15158890187740326,
-1.334731101989746,
-0.055994149297475815,
0.6188806891441345,
-0.5005826950073242,
-0.017499474808573723,
-0.6295310258865356,
-0.09088894724845886,
-0.08753453195095062,
-0.8214886... |
javascript/reference/global_objects/math/sumprecise/index.md | JavaScript - Global Objects - Math - sumPrecise - Description:
Because `sumPrecise()` is a static method of `Math`, you always use it as `Math.sumPrecise()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).
The method is called `Math.sumPrecise()` because it is more precise than n... | [
-0.3878478407859802,
0.40604710578918457,
-1.4624531269073486,
0.00657250639051199,
0.7731525897979736,
-1.410509467124939,
0.22427648305892944,
0.6358089447021484,
-0.3852442800998688,
0.6959850788116455,
-0.9255790710449219,
1.1833438873291016,
0.40732261538505554,
-0.528668999671936,
... |
javascript/reference/global_objects/math/sumprecise/index.md | JavaScript - Global Objects - Math - sumPrecise - Examples - Using Math.sumPrecise():
Example:
console.log(Math.sumPrecise([1, 2, 3])); // 6
console.log(Math.sumPrecise([1e20, 0.1, -1e20])); // 0.1 | [
-0.36775287985801697,
0.3679320514202118,
-0.7828564047813416,
-0.23699040710926056,
-0.24979940056800842,
-1.7322282791137695,
0.05639117956161499,
0.2633051872253418,
-0.5815961956977844,
-0.5183488130569458,
-0.2590269446372986,
0.8627904057502747,
0.1829313188791275,
-0.873803734779357... |
javascript/reference/global_objects/math/trunc/index.md | JavaScript - Global Objects - Math - trunc:
The `Math.trunc()` static method returns the integer part of a number by removing any fractional digits.
Example:
console.log(Math.trunc(13.37));
// Expected output: 13
console.log(Math.trunc(42.84));
// Expected output: 42
console.log(Math.trunc(0.123));
// Expected out... | [
-1.3165624141693115,
0.21584239602088928,
-1.069815993309021,
-0.35154181718826294,
-0.07475246489048004,
-1.2763464450836182,
0.5407088994979858,
0.1339266300201416,
-0.3729760944843292,
0.881405234336853,
-1.1888982057571411,
0.32560816407203674,
-0.20628194510936737,
0.1846315562725067,... |
javascript/reference/global_objects/math/trunc/index.md | JavaScript - Global Objects - Math - trunc - Syntax:
Example:
Math.trunc(x) | [
-0.7902320623397827,
0.924694299697876,
-1.149924635887146,
-1.1833137273788452,
-1.2089592218399048,
-1.7275681495666504,
0.596226692199707,
0.6503822207450867,
-0.020368387922644615,
-0.21533450484275818,
-0.6413039565086365,
0.048675667494535446,
-0.220123291015625,
0.040288180112838745... |
javascript/reference/global_objects/math/trunc/index.md | JavaScript - Global Objects - Math - trunc - Syntax - Parameters:
- `x`: A number. | [
-0.6939539313316345,
0.1864462047815323,
-1.5789567232131958,
-1.2898492813110352,
-1.0958101749420166,
-1.5806583166122437,
0.49420514702796936,
0.41780245304107666,
0.21399614214897156,
-0.3546575903892517,
-1.4240937232971191,
-0.33290573954582214,
-0.2931029200553894,
0.380294561386108... |
javascript/reference/global_objects/math/trunc/index.md | JavaScript - Global Objects - Math - trunc - Syntax - Return value:
The integer part of `x`. | [
-1.012281060218811,
0.6989924907684326,
-1.012596845626831,
-0.7788408398628235,
-0.8302401900291443,
-1.184720754623413,
0.9515964388847351,
0.4022691249847412,
0.09276115894317627,
0.42582499980926514,
-0.8129790425300598,
0.1393132209777832,
-0.2873477041721344,
0.8033722043037415,
0.... |
javascript/reference/global_objects/math/trunc/index.md | JavaScript - Global Objects - Math - trunc - Description:
The way `Math.trunc()` works is more straightforward than the other three `Math` methods: `Math.floor()`, `Math.ceil()` and `Math.round()`; it truncates (cuts off) the dot and the digits to the right of it, no matter whether the argument is a positive or negati... | [
-1.3195044994354248,
0.7314184904098511,
-0.700629711151123,
-0.2932308316230774,
-0.11918079853057861,
-1.6634721755981445,
0.38579612970352173,
0.3501165509223938,
-0.10910732299089432,
0.9958286881446838,
-1.5322870016098022,
0.006219304166734219,
0.19205710291862488,
-0.213410913944244... |
javascript/reference/global_objects/math/trunc/index.md | JavaScript - Global Objects - Math - trunc - Examples - Using Math.trunc():
Example:
Math.trunc(-Infinity); // -Infinity
Math.trunc("-1.123"); // -1
Math.trunc(-0.123); // -0
Math.trunc(-0); // -0
Math.trunc(0); // 0
Math.trunc(0.123); // 0
Math.trunc(13.37); // 13
Math.trunc(42.84); // 42
Math.trunc(Infinity); // In... | [
-1.6940362453460693,
0.7905007004737854,
-0.5582073330879211,
-0.4711681008338928,
-0.67482590675354,
-1.641789436340332,
0.31369346380233765,
-0.13365770876407623,
-0.2894243001937866,
-0.3006610870361328,
-1.1345092058181763,
-0.10877906531095505,
0.2925918698310852,
0.024076277390122414... |
javascript/reference/global_objects/math/trunc/index.md | JavaScript - Global Objects - Math - trunc - Examples - Using bitwise no-ops to truncate numbers:
Warning: This is not a polyfill for `Math.trunc()` because of non-negligible edge cases.
Bitwise operations convert their operands to 32-bit integers, which people have historically taken advantage of to truncate float-p... | [
-0.9326549172401428,
0.6600836515426636,
-0.8000454306602478,
0.35822024941444397,
0.15315477550029755,
-1.307867407798767,
0.7014131546020508,
0.46878424286842346,
0.10133618861436844,
1.229318618774414,
-1.2843235731124878,
-0.32259616255760193,
0.30953875184059143,
-0.30126285552978516,... |
javascript/reference/global_objects/math/acosh/index.md | JavaScript - Global Objects - Math - acosh:
The `Math.acosh()` static method returns the inverse hyperbolic cosine of a number. That is,
Example:
console.log(Math.acosh(0.999999999999));
// Expected output: NaN
console.log(Math.acosh(1));
// Expected output: 0
console.log(Math.acosh(2));
// Expected output: 1.3169... | [
-0.26901230216026306,
-0.5620699524879456,
-1.10378897190094,
0.0453144796192646,
-0.18784792721271515,
-1.027573823928833,
0.28031960129737854,
0.40997228026390076,
-0.6276609897613525,
1.30365788936615,
-1.0590169429779053,
0.6046217083930969,
0.9451571702957153,
0.10714617371559143,
0... |
javascript/reference/global_objects/math/acosh/index.md | JavaScript - Global Objects - Math - acosh - Syntax:
Example:
Math.acosh(x) | [
0.6851347088813782,
0.2099897563457489,
-1.2684893608093262,
-1.1329386234283447,
-1.1653330326080322,
-1.851069688796997,
0.7882363796234131,
0.8011980056762695,
0.25635334849357605,
-0.32278695702552795,
-0.5375959277153015,
0.6784244179725647,
0.011042539961636066,
0.3406371474266052,
... |
javascript/reference/global_objects/math/acosh/index.md | JavaScript - Global Objects - Math - acosh - Syntax - Parameters:
- `x`: A number greater than or equal to 1. | [
0.5592615604400635,
-0.6874091029167175,
-1.079737901687622,
-1.116031289100647,
-0.8484482169151306,
-1.7446212768554688,
0.6839745044708252,
0.5027549862861633,
0.5245069265365601,
-0.5982800126075745,
-1.2855613231658936,
-0.0024375682696700096,
-0.5629405379295349,
0.5071384906768799,
... |
javascript/reference/global_objects/math/acosh/index.md | JavaScript - Global Objects - Math - acosh - Syntax - Return value:
The inverse hyperbolic cosine of `x`. If `x` is less than 1, returns `NaN`. | [
-0.6636556386947632,
-0.24615442752838135,
-0.4103150963783264,
0.045747026801109314,
-0.681988000869751,
-0.8446058630943298,
0.8674535155296326,
0.6648780107498169,
-0.8241445422172546,
0.8528626561164856,
-1.8124572038650513,
0.2654905617237091,
0.23800620436668396,
0.5594804883003235,
... |
javascript/reference/global_objects/math/acosh/index.md | JavaScript - Global Objects - Math - acosh - Description:
Because `acosh()` is a static method of `Math`, you always use it as `Math.acosh()`, rather than as a method of a `Math` object you created (`Math` is no constructor). | [
0.13059101998806,
-0.48038598895072937,
-0.9818660616874695,
-0.2638217508792877,
-0.18152591586112976,
-2.5196454524993896,
0.3828989565372467,
0.9455176591873169,
0.34600159525871277,
0.713654100894928,
-0.6825624108314514,
0.4044930040836334,
1.0289665460586548,
-0.01681060716509819,
... |
javascript/reference/global_objects/math/acosh/index.md | JavaScript - Global Objects - Math - acosh - Examples - Using Math.acosh():
Example:
Math.acosh(0); // NaN
Math.acosh(1); // 0
Math.acosh(2); // 1.3169578969248166
Math.acosh(Infinity); // Infinity | [
-0.45955121517181396,
0.3464541733264923,
-0.3009909689426422,
-0.6161555051803589,
-0.6589506268501282,
-1.2052180767059326,
0.7910401225090027,
-0.4069536626338959,
-0.4863598644733429,
0.09887969493865967,
-0.8003283739089966,
0.22568580508232117,
0.5915043354034424,
-0.2117331475019455... |
javascript/reference/global_objects/math/exp/index.md | JavaScript - Global Objects - Math - exp:
The `Math.exp()` static method returns e raised to the power of a number. That is
Example:
console.log(Math.exp(0));
// Expected output: 1
console.log(Math.exp(1));
// Expected output: 2.718281828459 (approximately)
console.log(Math.exp(-1));
// Expected output: 0.36787944... | [
-1.4265122413635254,
-0.25960826873779297,
-0.7840108871459961,
-0.2467576265335083,
-0.015597104094922543,
-1.5781141519546509,
0.40097999572753906,
0.9844921827316284,
-0.16485866904258728,
0.14510765671730042,
0.05780820548534393,
1.1999807357788086,
-0.19613443315029144,
-0.34678354859... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.