file stringlengths 16 94 | text stringlengths 32 24.4k | vector list |
|---|---|---|
javascript/reference/global_objects/math/pow/index.md | JavaScript - Global Objects - Math - pow - Syntax - Parameters:
- `base`: The base number.
- `exponent`: The exponent number. | [
0.4870692193508148,
-0.48733481764793396,
-1.688705563545227,
-0.49374306201934814,
-0.2502761483192444,
-2.146780014038086,
1.0798125267028809,
0.4973883032798767,
0.4023306965827942,
-0.8262289762496948,
-1.5242886543273926,
1.1138049364089966,
-0.31791767477989197,
0.2369161695241928,
... |
javascript/reference/global_objects/math/pow/index.md | JavaScript - Global Objects - Math - pow - Syntax - Return value:
A number representing `base` taken to the power of `exponent`. Returns `NaN` in one of the following cases:
- `exponent` is `NaN`.
- `base` is `NaN` and `exponent` is not `0`.
- `base` is ±1 and `exponent` is ±`Infinity`.
- `base < 0` and `exponent` is... | [
-0.5638983249664307,
-0.09525801986455917,
-0.8336542248725891,
-0.20749840140342712,
-0.5461334586143494,
-1.6943743228912354,
1.7213228940963745,
0.6639282703399658,
-0.02378758415579796,
0.05893883854150772,
-0.905377984046936,
1.2722598314285278,
-0.07985618710517883,
0.318723320960998... |
javascript/reference/global_objects/math/pow/index.md | JavaScript - Global Objects - Math - pow - Description:
`Math.pow()` is equivalent to the `**` operator, except `Math.pow()` only accepts numbers.
`Math.pow(NaN, 0)` (and the equivalent `NaN ** 0`) is the only case where `NaN` doesn't propagate through mathematical operations — it returns `1` despite the operand bein... | [
-1.0517463684082031,
-0.23020349442958832,
-1.1784675121307373,
0.2015547901391983,
0.24770961701869965,
-1.0899665355682373,
0.6309226751327515,
1.2747793197631836,
-0.4282636344432831,
0.775194525718689,
-0.9222283363342285,
0.19622722268104553,
0.5745434165000916,
-1.0224889516830444,
... |
javascript/reference/global_objects/math/pow/index.md | JavaScript - Global Objects - Math - pow - Examples - Using Math.pow():
Example:
// Basic cases
Math.pow(7, 2); // 49
Math.pow(7, 3); // 343
Math.pow(2, 10); // 1024
// Fractional exponents
Math.pow(4, 0.5); // 2 (square root of 4)
Math.pow(8, 1 / 3); // 2 (cube root of 8)
Math.pow(2, 0.5); // 1.4142135623730951 (sq... | [
-0.26117104291915894,
-0.08870982378721237,
-0.1761874109506607,
0.5166746973991394,
0.3121153712272644,
-0.3084104359149933,
1.0026036500930786,
1.0109559297561646,
-0.056533992290496826,
0.40611928701400757,
-0.8520771861076355,
-0.28677496314048767,
-0.4902365505695343,
0.25986129045486... |
javascript/reference/global_objects/math/log2/index.md | JavaScript - Global Objects - Math - log2:
The `Math.log2()` static method returns the base 2 logarithm of a number. That is
Example:
console.log(Math.log2(3));
// Expected output: 1.584962500721156
console.log(Math.log2(2));
// Expected output: 1
console.log(Math.log2(1));
// Expected output: 0
console.log(Math.... | [
-0.6347079873085022,
-0.039667170494794846,
-1.4347665309906006,
0.11007130146026611,
-0.02615618146955967,
-1.4810413122177124,
-0.5552904605865479,
0.5683254599571228,
-0.16156162321567535,
-0.26596948504447937,
-0.5781154036521912,
0.7231003046035767,
0.5505356788635254,
-0.118510752916... |
javascript/reference/global_objects/math/log2/index.md | JavaScript - Global Objects - Math - log2 - Syntax:
Example:
Math.log2(x) | [
-0.4105719327926636,
0.378128319978714,
-0.9901931285858154,
-0.43274635076522827,
-1.028738260269165,
-1.5439012050628662,
0.05925782397389412,
0.9621808528900146,
-0.1620343029499054,
-1.4268070459365845,
-0.16081413626670837,
0.41457974910736084,
0.17906635999679565,
-0.1296087801456451... |
javascript/reference/global_objects/math/log2/index.md | JavaScript - Global Objects - Math - log2 - Syntax - Parameters:
- `x`: A number greater than or equal to 0. | [
-0.3408947288990021,
-0.419174462556839,
-1.1497251987457275,
-0.5927174687385559,
-0.9053540825843811,
-1.5095341205596924,
0.33007532358169556,
0.8295190930366516,
0.3140925168991089,
-1.1640690565109253,
-1.0717072486877441,
0.09230723977088928,
-0.30051085352897644,
0.01408728584647178... |
javascript/reference/global_objects/math/log2/index.md | JavaScript - Global Objects - Math - log2 - Syntax - Return value:
The base 2 logarithm of `x`. If `x < 0`, returns `NaN`. | [
-0.48070138692855835,
0.25537511706352234,
-1.0884644985198975,
-0.31613579392433167,
-0.598865807056427,
-0.6721214056015015,
0.5566158890724182,
0.5859056115150452,
-0.6588113307952881,
-0.39851218461990356,
-0.8905868530273438,
0.7924740314483643,
-0.35917168855667114,
0.512735247611999... |
javascript/reference/global_objects/math/log2/index.md | JavaScript - Global Objects - Math - log2 - Description:
Because `log2()` is a static method of `Math`, you always use it as `Math.log2()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).
This function is the equivalent of `Math.log(x) / Math.log(2)`. For `log2(e)`, use the const... | [
-0.9962589740753174,
0.004765538964420557,
-0.9548899531364441,
0.2660731375217438,
-0.08744020015001297,
-1.949677586555481,
-0.3119535744190216,
1.179084300994873,
-0.5727633237838745,
0.28254586458206177,
-0.5349001884460449,
0.5869290828704834,
0.641930341720581,
-0.33206692337989807,
... |
javascript/reference/global_objects/math/log2/index.md | JavaScript - Global Objects - Math - log2 - Examples - Using Math.log2():
Example:
Math.log2(-2); // NaN
Math.log2(-0); // -Infinity
Math.log2(0); // -Infinity
Math.log2(1); // 0
Math.log2(2); // 1
Math.log2(3); // 1.584962500721156
Math.log2(1024); // 10
Math.log2(Infinity); // Infinity | [
-1.2808982133865356,
0.23114202916622162,
-0.40490153431892395,
0.03349209576845169,
-0.35856908559799194,
-1.4098275899887085,
0.3898768424987793,
-0.16350097954273224,
-0.6744964122772217,
-0.8718562126159668,
-0.637535035610199,
0.2056204229593277,
0.4310101270675659,
-0.620297729969024... |
javascript/reference/global_objects/math/ceil/index.md | JavaScript - Global Objects - Math - ceil:
The `Math.ceil()` static method always rounds up and returns the smallest integer greater than or equal to a given number.
Example:
console.log(Math.ceil(0.95));
// Expected output: 1
console.log(Math.ceil(4));
// Expected output: 4
console.log(Math.ceil(7.004));
// Expec... | [
-1.9621503353118896,
0.17187559604644775,
-1.059903860092163,
-0.2239086776971817,
0.026879431679844856,
-0.9613548517227173,
0.12067575752735138,
1.0582526922225952,
-0.6539102792739868,
0.3167777359485626,
-0.15045878291130066,
0.7124796509742737,
-0.05001528933644295,
-0.085681520402431... |
javascript/reference/global_objects/math/ceil/index.md | JavaScript - Global Objects - Math - ceil - Syntax:
Example:
Math.ceil(x) | [
-1.0365946292877197,
0.28392738103866577,
-0.9486184120178223,
-0.6795510053634644,
-0.7980483174324036,
-1.46687912940979,
0.8103142976760864,
1.50447678565979,
-0.5117394328117371,
-0.4422357678413391,
0.050028711557388306,
0.5923996567726135,
-0.10310052335262299,
-0.1856248527765274,
... |
javascript/reference/global_objects/math/ceil/index.md | JavaScript - Global Objects - Math - ceil - Syntax - Parameters:
- `x`: A number. | [
-0.7456314563751221,
-0.34604132175445557,
-1.5391062498092651,
-1.1290627717971802,
-0.8346474766731262,
-1.432883858680725,
0.7483431100845337,
0.9852795004844666,
-0.07042752951383591,
-0.5957662463188171,
-0.7849770188331604,
0.09220758825540543,
-0.1524202823638916,
0.0908448249101638... |
javascript/reference/global_objects/math/ceil/index.md | JavaScript - Global Objects - Math - ceil - Syntax - Return value:
The smallest integer greater than or equal to `x`. It's the same value as `-Math.floor(-x)`. | [
-1.287024736404419,
0.5652689337730408,
-1.267947793006897,
-0.47250813245773315,
-0.8873145580291748,
-1.0051194429397583,
1.0611224174499512,
0.8686646223068237,
-0.4769609272480011,
0.1283821165561676,
-0.3259316682815552,
0.7567399144172668,
-0.07743910700082779,
0.47966137528419495,
... |
javascript/reference/global_objects/math/ceil/index.md | JavaScript - Global Objects - Math - ceil - Description:
Because `ceil()` is a static method of `Math`, you always use it as `Math.ceil()`, rather than as a method of a `Math` object you created (`Math` is not a constructor). | [
-1.2496308088302612,
-0.2741137444972992,
-0.7875657677650452,
-0.014321377500891685,
0.005948449485003948,
-2.113335132598877,
0.42384961247444153,
1.6468347311019897,
-0.4315420091152191,
0.34096428751945496,
-0.14218363165855408,
0.5368891358375549,
0.5795262455940247,
-0.32635042071342... |
javascript/reference/global_objects/math/ceil/index.md | JavaScript - Global Objects - Math - ceil - Examples - Using Math.ceil():
Example:
Math.ceil(-Infinity); // -Infinity
Math.ceil(-7.004); // -7
Math.ceil(-4); // -4
Math.ceil(-0.95); // -0
Math.ceil(-0); // -0
Math.ceil(0); // 0
Math.ceil(0.95); // 1
Math.ceil(4); // 4
Math.ceil(7.004); // 8
Math.ceil(Infinity); // In... | [
-1.8107212781906128,
0.721020519733429,
-0.562316358089447,
-0.08667480945587158,
-0.36450693011283875,
-1.3802435398101807,
0.6965197920799255,
0.7752674221992493,
-0.23816440999507904,
-0.5189183950424194,
-0.16899794340133667,
0.31715747714042664,
0.3450210988521576,
-0.6780025362968445... |
javascript/reference/global_objects/math/ln10/index.md | JavaScript - Global Objects - Math - LN10:
The `Math.LN10` static data property represents the natural logarithm of 10, approximately 2.303.
Example:
function getNatLog10() {
return Math.LN10;
}
console.log(getNatLog10());
// Expected output: 2.302585092994046 | [
-0.8725526928901672,
0.40747857093811035,
-1.236592173576355,
-0.24877019226551056,
-0.9202879667282104,
-1.3414394855499268,
-1.0373117923736572,
0.20517154037952423,
-0.4451998174190521,
0.10568505525588989,
-0.6930340528488159,
0.6476487517356873,
-0.6281240582466125,
0.2546072602272033... |
javascript/reference/global_objects/math/ln10/index.md | JavaScript - Global Objects - Math - LN10 - Description:
Because `LN10` is a static property of `Math`, you always use it as `Math.LN10`, rather than as a property of a `Math` object you created (`Math` is not a constructor). | [
-1.1602730751037598,
0.1531372368335724,
-0.7337084412574768,
-0.1818515509366989,
-0.5466128587722778,
-2.136321783065796,
-0.2785634696483612,
1.1958231925964355,
-0.21277165412902832,
0.1159127801656723,
-0.9886034727096558,
0.9105033278465271,
-0.28604763746261597,
0.05619604513049126,... |
javascript/reference/global_objects/math/ln10/index.md | JavaScript - Global Objects - Math - LN10 - Examples - Using Math.LN10:
The following function returns the natural log of 10:
Example:
function getNatLog10() {
return Math.LN10;
}
getNatLog10(); // 2.302585092994046 | [
-0.6963404417037964,
0.9511081576347351,
-1.1989152431488037,
-0.3715423047542572,
-1.2922378778457642,
-1.1051028966903687,
-0.2883645296096802,
-0.006284096743911505,
-1.1747111082077026,
-0.37723323702812195,
-0.4908686578273773,
0.8391415476799011,
-0.9010847210884094,
0.45744910836219... |
javascript/reference/global_objects/math/f16round/index.md | JavaScript - Global Objects - Math - f16round:
The `Math.f16round()` static method returns the nearest 16-bit half precision float representation of a number.
Example:
console.log(Math.f16round(5.5));
// Expected output: 5.5
console.log(Math.f16round(5.05));
// Expected output: 5.05078125
console.log(Math.f16round... | [
-0.6632457971572876,
-0.8475140333175659,
-1.2124533653259277,
-0.38447099924087524,
0.02094694785773754,
-0.8117092251777649,
0.6487806439399719,
0.671653687953949,
0.32464635372161865,
0.5015532970428467,
-0.8148089647293091,
1.406087040901184,
0.14791597425937653,
-0.20972152054309845,
... |
javascript/reference/global_objects/math/f16round/index.md | JavaScript - Global Objects - Math - f16round - Syntax:
Example:
Math.f16round(doubleFloat) | [
-0.865320086479187,
0.07439067214727402,
-0.8780961036682129,
-1.082031488418579,
-0.5041019320487976,
-0.9202379584312439,
0.8820074796676636,
0.7808805704116821,
-0.2758185863494873,
-0.6976066827774048,
-0.3442878723144531,
1.1262954473495483,
-0.36819425225257874,
-0.5361351370811462,
... |
javascript/reference/global_objects/math/f16round/index.md | JavaScript - Global Objects - Math - f16round - Syntax - Parameters:
- `doubleFloat`: A number. | [
-1.0829062461853027,
-0.37002184987068176,
-1.4207851886749268,
-1.353745937347412,
-0.3628402054309845,
-1.064406156539917,
0.9925680160522461,
0.31789079308509827,
-0.25745078921318054,
-0.6202418208122253,
-1.055131435394287,
0.4461052417755127,
-0.5506089329719543,
-0.10543128103017807... |
javascript/reference/global_objects/math/f16round/index.md | JavaScript - Global Objects - Math - f16round - Syntax - Return value:
The nearest 16-bit half precision float representation of `doubleFloat`. | [
-1.3298753499984741,
-0.38567614555358887,
-0.7576289772987366,
-0.7771191596984863,
-0.7403206825256348,
-0.5939891934394836,
1.4577490091323853,
0.379928320646286,
0.3035277724266052,
-0.27663615345954895,
-0.21039675176143646,
1.0681813955307007,
0.7368795275688171,
0.5457682609558105,
... |
javascript/reference/global_objects/math/f16round/index.md | JavaScript - Global Objects - Math - f16round - Description:
`Math.f16round` is the 16-bit counterpart of `Math.fround()`. It is intended to smooth some rough edges when interacting with float16 numbers, such as when reading from a `Float16Array`. Internally, JavaScript continues to treat the number as a 64-bit float,... | [
-0.3504297733306885,
0.20527304708957672,
-0.5660961866378784,
-0.535348117351532,
0.3830869495868683,
-1.0435584783554077,
0.8384623527526855,
0.33266115188598633,
0.33612120151519775,
0.34572190046310425,
-0.9761745929718018,
1.5764192342758179,
-0.6943269371986389,
-0.3270570933818817,
... |
javascript/reference/global_objects/math/f16round/index.md | JavaScript - Global Objects - Math - f16round - Examples - Using Math.f16round():
The number 1.5 can be precisely represented in the binary numeral system, and is identical in 16-bit and 64-bit:
Example:
Math.f16round(1.5); // 1.5
Math.f16round(1.5) === 1.5; // true
However, the number 1.337 cannot be precisely rep... | [
-0.11096036434173584,
-0.4330346882343292,
-0.6209144592285156,
-0.7346651554107666,
-0.10884574055671692,
-1.4065827131271362,
0.942573606967926,
0.2863653302192688,
0.10856787115335464,
-0.09339109808206558,
-1.1411350965499878,
0.7897953391075134,
-0.08816578984260559,
-0.38326379656791... |
javascript/reference/global_objects/function/index.md | JavaScript - Global Objects - Function:
The `Function` object provides methods for functions. In JavaScript, every function is actually a `Function` object. | [
-0.6259777545928955,
-0.8824268579483032,
-1.3546329736709595,
0.34431689977645874,
-0.2903577387332916,
-2.152218818664551,
0.08233146369457245,
0.2807922661304474,
-0.4066300392150879,
-0.527755856513977,
-0.6870457530021667,
-0.36140015721321106,
-0.2519381046295166,
0.2558683454990387,... |
javascript/reference/global_objects/function/index.md | JavaScript - Global Objects - Function - Constructor:
- `Function()`: Creates a new `Function` object. Calling the constructor directly can create functions dynamically but suffers from security and similar (but far less significant) performance issues to `eval()`. However, unlike `eval()`, the `Function` constructor ... | [
-1.094476342201233,
-0.4284801185131073,
-0.5953834056854248,
0.6167747378349304,
0.12951119244098663,
-1.7250021696090698,
-0.9526503682136536,
0.324864000082016,
-0.48459815979003906,
0.19215257465839386,
-0.4783262610435486,
0.059691231697797775,
-0.3193981349468231,
0.05222458019852638... |
javascript/reference/global_objects/function/index.md | JavaScript - Global Objects - Function - Instance properties:
These properties are defined on `Function.prototype` and shared by all `Function` instances.
- `Function.prototype.arguments` (deprecated) (non-standard): Represents the arguments passed to this function. For strict, arrow, async, and generator functions, ... | [
-0.3873310387134552,
-0.7628666758537292,
-0.9752702713012695,
0.4359377324581146,
-0.08857379853725433,
-2.050459384918213,
-0.1908520758152008,
0.4285932779312134,
0.20444852113723755,
-0.018929002806544304,
-1.0237728357315063,
0.4965553283691406,
-0.51022869348526,
0.5284967422485352,
... |
javascript/reference/global_objects/function/index.md | JavaScript - Global Objects - Function - Instance methods:
- `Function.prototype.apply()`: Calls a function with a given `this` value and optional arguments provided as an array (or an array-like object).
- `Function.prototype.bind()`: Creates a new function that, when called, has its `this` keyword set to a provided ... | [
-0.6439410448074341,
-0.5614311695098877,
-0.3698119819164276,
0.6818069815635681,
-0.0997147485613823,
-1.6243209838867188,
0.10680898278951645,
0.29090332984924316,
-0.03409064561128616,
-0.2461930513381958,
-1.098739504814148,
0.3651615083217621,
0.34704792499542236,
0.29267406463623047... |
javascript/reference/global_objects/function/index.md | JavaScript - Global Objects - Function - Examples - Difference between Function constructor and function declaration:
Functions created with the `Function` constructor do not create closures to their creation contexts; they always are created in the global scope. When running them, they will only be able to access the... | [
-0.15530499815940857,
-0.2496827393770218,
-0.8546839952468872,
0.8260231614112854,
0.8838388323783875,
-0.4766918420791626,
0.030009320005774498,
0.31874072551727295,
-0.3812280595302582,
-0.10222498327493668,
-0.02805248647928238,
-0.15921543538570404,
-0.3764074444770813,
0.468747168779... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name:
The `name` data property of a `Function` instance indicates the function's name as specified when it was created, or it may be either `anonymous` or `''` (an empty string) for functions created anonymously.
Example:
const func1 = function () {};
const object = {
func... | [
-0.6326350569725037,
-0.6002370715141296,
-1.083791732788086,
0.6889759302139282,
0.1474996656179428,
-1.993828296661377,
0.34755849838256836,
0.39468103647232056,
-0.016002023592591286,
-0.2014843225479126,
-0.4725024104118347,
-0.22984138131141663,
-0.3834521472454071,
-0.016721609979867... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Value:
A string.
Note: In non-standard, pre-ES2015 implementations the `configurable` attribute was `false` as well. | [
-0.8790085911750793,
-0.25298652052879333,
-1.006747841835022,
-0.15628306567668915,
-0.12491711229085922,
-2.6528377532958984,
0.2993588447570801,
0.5017959475517273,
-0.28499191999435425,
0.010897441767156124,
-0.47600358724594116,
-0.12176449596881866,
-0.016704324632883072,
-0.25079917... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description:
The function's `name` property can be used to identify the function in debugging tools or error messages. It has no semantic significance to the language itself.
The `name` property is read-only and cannot be changed by the assignment operator:
Example:
f... | [
-0.6431092023849487,
-0.17217785120010376,
-1.1090126037597656,
0.2769698202610016,
-0.11323090642690659,
-2.3633289337158203,
0.658954918384552,
0.26183491945266724,
0.231699138879776,
-0.42398232221603394,
-0.7859952449798584,
-0.2852642834186554,
-0.2428104281425476,
-0.1601338982582092... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Function declaration:
The `name` property returns the name of a function declaration.
Example:
function doSomething() {}
doSomething.name; // "doSomething" | [
-1.0835129022598267,
-0.29419228434562683,
-1.1431517601013184,
-0.02970309555530548,
-0.5076500177383423,
-1.700299859046936,
0.5827298760414124,
0.8343631625175476,
-0.1974027007818222,
-0.5267866849899292,
-0.5938241481781006,
0.03785058483481407,
-0.20005789399147034,
-0.18776783347129... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Default-exported function declaration:
An `export default` declaration exports the function as a declaration instead of an expression. If the declaration is anonymous, the name is `"default"`.
Example:
// -- someModule.js --
export default function () {}
... | [
-0.8130260109901428,
-0.22500887513160706,
-1.2129656076431274,
0.8676865100860596,
-0.8480441570281982,
-1.4101922512054443,
0.403161883354187,
0.7677944302558899,
-0.2672775089740753,
0.12965893745422363,
-0.8717499375343323,
0.30527263879776,
-0.5266546607017517,
0.24102281033992767,
... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Function constructor:
Functions created with the `Function()` constructor have name "anonymous".
Example:
new Function().name; // "anonymous" | [
-1.113375186920166,
-0.19127975404262543,
-1.004073143005371,
0.1948608011007309,
-0.34796759486198425,
-1.8572568893432617,
0.29871848225593567,
0.5622470378875732,
-0.22604848444461823,
-0.27133142948150635,
-0.6990696787834167,
-0.3878236413002014,
-0.6492648720741272,
-0.22591839730739... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Function expression:
If the function expression is named, that name is used as the `name` property.
Example:
const someFunction = function someFunctionName() {};
someFunction.name; // "someFunctionName"
Anonymous function expressions, created using eithe... | [
-0.28011268377304077,
0.2621821165084839,
-1.3042833805084229,
0.18156340718269348,
-0.2667110860347748,
-2.3274471759796143,
1.1600682735443115,
0.7040640115737915,
0.1599232703447342,
-0.30367493629455566,
-0.369899719953537,
-0.17803111672401428,
-0.6261346936225891,
-0.3257733881473541... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Variable declaration and method:
Variables and methods can infer the name of an anonymous function from its syntactic position.
Example:
const f = function () {};
const object = {
someMethod: function () {},
};
console.log(f.name); // "f"
console.log(o... | [
-0.013920911587774754,
-0.5347588062286377,
-0.6676267385482788,
0.3873519003391266,
0.010764154605567455,
-1.9627386331558228,
0.6711665987968445,
0.4973132312297821,
0.22360381484031677,
-0.2739287316799164,
-0.47467222809791565,
-0.3136683404445648,
-0.40724775195121765,
-0.282099753618... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Initializer and default value:
Functions in initializers (default values) of destructuring, default parameters, class fields, etc., will inherit the name of the bound identifier as their `name`.
Example:
const [f = () => {}] = [];
f.name; // "f"
const { ... | [
-0.03518394008278847,
-0.4436725974082947,
-1.8760188817977905,
-0.12203069031238556,
-0.6050173044204712,
-1.843072772026062,
0.3265950381755829,
1.072561264038086,
-0.22655092179775238,
-0.4121156334877014,
-1.3433722257614136,
-0.6634526252746582,
-0.5130505561828613,
-0.140346348285675... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Shorthand method:
Example:
const o = {
foo() {},
};
o.foo.name; // "foo"; | [
-0.02745814435184002,
-0.30481311678886414,
-1.5825080871582031,
-0.15218515694141388,
-0.35990580916404724,
-2.166376829147339,
0.4136488437652588,
1.0719529390335083,
-0.522985577583313,
-0.03892102465033531,
-1.0538548231124878,
0.04936928302049637,
0.20936354994773865,
-0.0919168293476... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Bound function:
`Function.prototype.bind()` produces a function whose name is "bound " plus the function name.
Example:
function foo() {}
foo.bind({}).name; // "bound foo" | [
-1.2369036674499512,
-0.09245912730693817,
-0.8541318774223328,
-0.2842308580875397,
-0.5435009598731995,
-1.3632770776748657,
0.17050069570541382,
1.029877781867981,
-0.7080695629119873,
-0.08143477886915207,
-1.3069288730621338,
0.014800677075982094,
-0.4159596562385559,
0.21232560276985... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Getter and setter:
When using `get` and `set` accessor properties, "get" or "set" will appear in the function name.
Example:
const o = {
get foo() {
return 1;
},
set foo(x) {},
};
const descriptor = Object.getOwnPropertyDescriptor(o, "foo");
de... | [
-0.8868367075920105,
-0.15832267701625824,
-2.1298563480377197,
0.07752547413110733,
-0.6688063740730286,
-1.6043262481689453,
-0.276659220457077,
0.3402058482170105,
0.3039551377296448,
-0.19240820407867432,
-0.5639722943305969,
-0.17131008207798004,
-0.4403294324874878,
0.146882846951484... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Class:
A class's name follows the same algorithm as function declarations and expressions.
Example:
class Foo {}
Foo.name; // "Foo"
Warning: JavaScript will set the function's `name` property only if a function does not have an own property called `name`... | [
-0.4017152488231659,
-0.9639703035354614,
-1.225389838218689,
0.7335854768753052,
-0.2195739597082138,
-2.197716474533081,
0.935059666633606,
0.6004796624183655,
-1.034103512763977,
-0.4977555274963379,
-0.5148270130157471,
-0.27516305446624756,
-0.44463789463043213,
-0.6497353911399841,
... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Symbol as function name:
If a `Symbol` is used a function name and the symbol has a description, the method's name is the description in square brackets.
Example:
const sym1 = Symbol("foo");
const sym2 = Symbol();
const o = {
[sym1]() {},
[sym2]() {}... | [
-0.20973195135593414,
-0.5428982377052307,
-1.1049476861953735,
-0.45651865005493164,
-0.15568168461322784,
-2.602621555328369,
0.037947747856378555,
0.7139773368835449,
0.21659868955612183,
-0.20105284452438354,
-1.1070265769958496,
0.2976270616054535,
0.3665400445461273,
-0.4134516417980... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Description - Private fields and methods:
Private fields and private methods have the hash (`#`) as part of their names.
Example:
class Foo {
#field = () => {};
#method() {}
getNames() {
console.log(this.#field.name);
console.log(this.#method.name);
}
}... | [
-0.09155791252851486,
-0.9402863383293152,
-1.440324306488037,
-0.04880360886454582,
-0.4268258213996887,
-2.1973204612731934,
1.126232385635376,
0.20939642190933228,
-0.49458691477775574,
-0.3628048300743103,
-1.0298681259155273,
0.12863275408744812,
-0.4776555001735687,
-0.48302322626113... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Examples - Telling the constructor name of an object:
You can use `obj.constructor.name` to check the "class" of an object.
Example:
function Foo() {} // Or: class Foo {}
const fooInstance = new Foo();
console.log(fooInstance.constructor.name); // "Foo"
However, beca... | [
-0.4061882197856903,
-0.7200659513473511,
-1.4329196214675903,
0.13586299121379852,
0.21385537087917328,
-1.8576833009719849,
0.31048569083213806,
0.6078599095344543,
-0.7027344107627869,
0.3351500630378723,
0.08726824820041656,
-0.007548260968178511,
-0.24516712129116058,
-0.5561878085136... |
javascript/reference/global_objects/function/name/index.md | JavaScript - Global Objects - Function - name - Examples - JavaScript compressors and minifiers:
Warning: Be careful when using the `name` property with source-code transformations, such as those carried out by JavaScript compressors (minifiers) or obfuscators. These tools are often used as part of a JavaScript build ... | [
0.9703842401504517,
-0.33823487162590027,
-1.191568374633789,
0.8335439562797546,
0.9823529720306396,
-1.7654227018356323,
0.6239530444145203,
0.8074495196342468,
-1.1466609239578247,
-0.18072208762168884,
-0.45458829402923584,
-0.45539116859436035,
0.26894962787628174,
-0.2062596082687378... |
javascript/reference/global_objects/function/tostring/index.md | JavaScript - Global Objects - Function - toString:
The `toString()` method of `Function` instances returns a string representing the source code of this function.
Example:
function sum(a, b) {
return a + b;
}
console.log(sum.toString());
// Expected output: "function sum(a, b) {
// return a + ... | [
-0.7373213171958923,
0.054534051567316055,
-1.1463643312454224,
-0.0787116214632988,
0.14288242161273956,
-1.7589821815490723,
-0.02484406903386116,
0.48593470454216003,
-0.4570721983909607,
-0.4146592915058136,
-0.07833658903837204,
0.8775858879089355,
0.36094674468040466,
-0.166273117065... |
javascript/reference/global_objects/function/tostring/index.md | JavaScript - Global Objects - Function - toString - Syntax:
Example:
toString() | [
-1.16876220703125,
0.4314570426940918,
-0.48652997612953186,
-0.19344793260097504,
-0.5061665773391724,
-2.4165544509887695,
0.08726240694522858,
0.4371051788330078,
-0.30375832319259644,
-0.872037410736084,
-0.2719663679599762,
0.2718169391155243,
-0.11884960532188416,
-0.3644612431526184... |
javascript/reference/global_objects/function/tostring/index.md | JavaScript - Global Objects - Function - toString - Syntax - Parameters:
None. | [
-1.0091402530670166,
0.3522551357746124,
-0.6435326337814331,
-0.584303617477417,
-0.47587114572525024,
-1.959502100944519,
0.44556787610054016,
0.4547124207019806,
-0.4385165572166443,
-0.9769733548164368,
-0.9449664354324341,
-0.6382237672805786,
0.05232568457722664,
-0.16386838257312775... |
javascript/reference/global_objects/function/tostring/index.md | JavaScript - Global Objects - Function - toString - Syntax - Return value:
A string representing the source code of the function. | [
-0.8389007449150085,
-0.042406365275382996,
-0.681738018989563,
-0.38130614161491394,
-0.3752160966396332,
-2.2973134517669678,
-0.041645485907793045,
0.666754424571991,
-0.08312317728996277,
-0.6106951832771301,
-0.5163431763648987,
0.6203807592391968,
-0.3526184558868408,
0.4881825745105... |
javascript/reference/global_objects/function/tostring/index.md | JavaScript - Global Objects - Function - toString - Description:
The `Function` object overrides the `toString()` method inherited from `Object`; it does not inherit `Object.prototype.toString`. For user-defined `Function` objects, the `toString` method returns a string containing the source text segment which was use... | [
-0.06847090274095535,
-0.05467071756720543,
-0.4608108699321747,
0.5668487548828125,
1.185056209564209,
-1.519219160079956,
0.45394444465637207,
0.8570870757102966,
-0.9817875027656555,
0.11635611951351166,
-0.24904440343379974,
0.3623042106628418,
0.055606551468372345,
0.42300179600715637... |
javascript/reference/global_objects/function/tostring/index.md | JavaScript - Global Objects - Function - toString - Examples - Comparing actual source code and toString results:
Example:
function test(fn) {
console.log(fn.toString());
}
function f() {}
class A {
a() {}
}
function* g() {}
test(f); // "function f() {}"
test(A); // "class A { a() {} }"
test(g); // "function* g... | [
-0.26311561465263367,
0.056276317685842514,
-0.10608918964862823,
0.061318133026361465,
1.0092886686325073,
-1.5061520338058472,
-0.19656124711036682,
0.2464234083890915,
-0.8033698797225952,
0.03549988940358162,
-0.4042162001132965,
0.4372170567512512,
-0.9197057485580444,
0.3348936438560... |
javascript/reference/global_objects/function/tostring/index.md | JavaScript - Global Objects - Function - toString - Examples - Getting source text of a function:
It is possible to get the source text of a function by coercing it to a string — for example, by wrapping it in a template literal:
Example:
function foo() {
return "bar";
}
console.log(`${foo}`);
// function foo() {
... | [
-0.5284784436225891,
-0.16581478714942932,
-0.00040125951636582613,
0.29586079716682434,
0.8429325222969055,
-1.5676648616790771,
0.6701374650001526,
0.2878934442996979,
-0.7660175561904907,
-0.37219303846359253,
-0.2268998622894287,
-0.37767112255096436,
-0.0746409073472023,
-0.0830065011... |
javascript/reference/global_objects/function/call/index.md | JavaScript - Global Objects - Function - call:
The `call()` method of `Function` instances calls this function with a given `this` value and arguments provided individually.
Example:
function Product(name, price) {
this.name = name;
this.price = price;
}
function Food(name, price) {
Product.call(this, name, p... | [
-0.433795690536499,
-0.2591469883918762,
-0.9951245784759521,
0.981770932674408,
-0.002791857346892357,
-0.9471599459648132,
0.18697187304496765,
0.5383148789405823,
-1.087990403175354,
-0.13525742292404175,
-0.41608500480651855,
-0.1823491007089615,
-0.2006836235523224,
0.2482035458087921... |
javascript/reference/global_objects/function/call/index.md | JavaScript - Global Objects - Function - call - Syntax:
Example:
call(thisArg)
call(thisArg, arg1)
call(thisArg, arg1, arg2)
call(thisArg, arg1, arg2, /* …, */ argN) | [
-0.4683630168437958,
0.9433026909828186,
-0.2817659080028534,
0.14316459000110626,
-0.6266980767250061,
-1.9324347972869873,
-0.0679803341627121,
0.8727149367332458,
-0.5884499549865723,
-0.4278046488761902,
-0.8746475577354431,
-0.06987351924180984,
-0.38016727566719055,
0.065976619720458... |
javascript/reference/global_objects/function/call/index.md | JavaScript - Global Objects - Function - call - Syntax - Parameters:
- `thisArg`: The value to use as `this` when calling `func`. If the function is not in strict mode, `null` and `undefined` will be replaced with the global object, and primitive values will be converted to objects.
- `arg1`, …, `argN` (optional): Arg... | [
-0.3793147802352905,
0.5389693379402161,
-0.5411868095397949,
0.4122145175933838,
-0.5782381296157837,
-2.5481607913970947,
0.6170975565910339,
0.46405237913131714,
0.024294665083289146,
0.035999905318021774,
-1.1083755493164062,
-0.18592184782028198,
-0.15681862831115723,
0.51980251073837... |
javascript/reference/global_objects/function/call/index.md | JavaScript - Global Objects - Function - call - Syntax - Return value:
The result of calling the function with the specified `this` value and arguments. | [
0.061464838683605194,
0.20308548212051392,
-1.0120245218276978,
0.00992698222398758,
-0.7464269995689392,
-1.4253145456314087,
0.18807655572891235,
0.7461026310920715,
-0.12026365846395493,
-0.16587142646312714,
-0.7493048906326294,
1.1391353607177734,
-0.03948616981506348,
0.9209833741188... |
javascript/reference/global_objects/function/call/index.md | JavaScript - Global Objects - Function - call - Description:
Note: This function is almost identical to `apply()`, except that the function arguments are passed to `call()` individually as a list, while for `apply()` they are combined in one object, typically an array — for example, `func.call(this, "eat", "bananas")`... | [
-0.8063222765922546,
0.19923514127731323,
-1.1959182024002075,
0.9550337195396423,
-0.2161535918712616,
-1.2801120281219482,
0.30244144797325134,
0.27703365683555603,
-0.6075336933135986,
0.007931872271001339,
-0.6904105544090271,
0.40493452548980713,
0.5006953477859497,
0.2106885761022567... |
javascript/reference/global_objects/function/call/index.md | JavaScript - Global Objects - Function - call - Examples - Using call() to invoke a function and specifying the this value:
In the example below, when we call `greet`, the value of `this` will be bound to object `obj`, even when `greet` is not a method of `obj`.
Example:
function greet() {
console.log(this.animal,... | [
-1.2109109163284302,
0.2885156571865082,
-1.3853856325149536,
0.16291870176792145,
-0.849055290222168,
-2.0934557914733887,
-0.4474279582500458,
-0.4122241139411926,
-0.6017454266548157,
-0.20794357359409332,
-0.1280696988105774,
0.7553844451904297,
0.24164830148220062,
-0.4465054571628570... |
javascript/reference/global_objects/function/call/index.md | JavaScript - Global Objects - Function - call - Examples - Using call() to invoke a function without specifying the first argument:
If the first `thisArg` parameter is omitted, it defaults to `undefined`. In non-strict mode, the `this` value is then substituted with `globalThis` (which is akin to the global object).
... | [
-0.9097952842712402,
0.5912581086158752,
-0.49449071288108826,
0.5129372477531433,
-0.6185003519058228,
-1.8278710842132568,
0.4725038409233093,
0.3134280741214752,
-0.2596021592617035,
-0.4184340834617615,
-0.4425170123577118,
-0.8191892504692078,
0.36767786741256714,
-0.40654677152633667... |
javascript/reference/global_objects/function/call/index.md | JavaScript - Global Objects - Function - call - Examples - Transforming methods to utility functions:
`call()` is almost equivalent to a normal function call, except that `this` is passed as a normal parameter instead of as the value that the function was accessed on. This is similar to how general-purpose utility fun... | [
-1.0000413656234741,
0.15619423985481262,
-1.1676464080810547,
0.9898515939712524,
0.25457707047462463,
-1.1994143724441528,
0.409061998128891,
-0.03376039117574692,
-0.04929870739579201,
0.6310960650444031,
-0.3763010501861572,
0.5587805509567261,
0.687775194644928,
-0.21199311316013336,
... |
javascript/reference/global_objects/function/function/index.md | JavaScript - Global Objects - Function:
Warning: The arguments passed to this constructor are dynamically parsed and executed as JavaScript. APIs like this are known as injection sinks, and are potentially a vector for cross-site-scripting (XSS) attacks. You can mitigate this risk by always passing `TrustedScript` obj... | [
-0.9184898734092712,
-0.38418349623680115,
-0.8454868793487549,
0.7334542870521545,
0.19983892142772675,
-1.7767164707183838,
-0.49384117126464844,
-0.3523433208465576,
-0.7670943737030029,
0.49832668900489807,
-0.6740168333053589,
0.778880774974823,
-0.05137117952108383,
-0.43383195996284... |
javascript/reference/global_objects/function/function/index.md | JavaScript - Global Objects - Function - Syntax:
Example:
new Function(functionBody)
new Function(arg1, functionBody)
new Function(arg1, arg2, functionBody)
new Function(arg1, arg2, /* …, */ argN, functionBody)
Function(functionBody)
Function(arg1, functionBody)
Function(arg1, arg2, functionBody)
Function(arg1, arg2... | [
-0.5555096864700317,
-0.006045838817954063,
-0.6956074833869934,
0.0871991440653801,
-0.163887619972229,
-2.504132032394409,
-0.7454572916030884,
0.6066005229949951,
-0.24968113005161285,
-0.7835658192634583,
-0.6598871946334839,
-0.4400986135005951,
-0.5648291707038879,
0.5457800030708313... |
javascript/reference/global_objects/function/function/index.md | JavaScript - Global Objects - Function - Syntax - Parameters:
- `arg1`, …, `argN` (optional): `TrustedScript` instances or strings specifying names to be used by the function as formal argument names. The value must correspond to a valid JavaScript parameter (any of plain identifier, rest parameter, or destructured pa... | [
-0.29801955819129944,
-0.09870593249797821,
-0.969237744808197,
0.090069979429245,
0.2470710426568985,
-2.503908157348633,
0.621133029460907,
-1.0627450942993164,
-0.8121230006217957,
-0.07162733376026154,
-0.4156864285469055,
-0.5256386399269104,
-1.2213332653045654,
0.4339527189731598,
... |
javascript/reference/global_objects/function/function/index.md | JavaScript - Global Objects - Function - Syntax - Exceptions:
- `SyntaxError`: Function parameter arguments can't be parsed as a valid parameter list, or the `functionBody` can't be parsed as valid JavaScript statements.
- `TypeError`: Any parameter is a string when Trusted Types are enforced by a CSP and no default p... | [
-0.6201125979423523,
-0.22039690613746643,
-0.8431495428085327,
0.784257709980011,
-0.5094302296638489,
-2.551389694213867,
0.04643075913190842,
0.14206212759017944,
-0.40101805329322815,
-0.1525888592004776,
-0.2863036096096039,
-0.3380894064903259,
-0.11561574786901474,
-0.06928123533725... |
javascript/reference/global_objects/function/function/index.md | JavaScript - Global Objects - Function - Description:
`Function` objects created with the `Function` constructor are parsed when the function is created. This is less efficient than creating a function with a function expression or function declaration and calling it within your code, because such functions are parsed... | [
0.3078124225139618,
0.30909690260887146,
-0.4206574857234955,
0.8045357465744019,
0.7482315301895142,
-1.1824843883514404,
-0.2626095414161682,
0.2442641705274582,
-0.7238588333129883,
0.28250420093536377,
-0.6001908779144287,
-0.3630366027355194,
-0.47579678893089294,
0.7031620740890503,
... |
javascript/reference/global_objects/function/function/index.md | JavaScript - Global Objects - Function - Description - Security considerations:
The method can be used to execute arbitrary input passed to any parameter. If the input is a potentially unsafe string provided by a user, this is a possible vector for Cross-site-scripting (XSS) attacks. For example, the following example... | [
-0.397244930267334,
0.337422251701355,
-0.5325795412063599,
0.7998064756393433,
0.517620325088501,
-0.06949013471603394,
0.23859484493732452,
0.04651886969804764,
-0.11018439382314682,
0.13545094430446625,
0.10249562561511993,
-0.19735023379325867,
-0.4316014051437378,
-0.3700747489929199,... |
javascript/reference/global_objects/function/function/index.md | JavaScript - Global Objects - Function - Examples:
Note that these examples omit the use of trusted types for brevity. For code showing the recommended approach, see Using `TrustedScript` in `eval()`. | [
-1.3975263833999634,
0.40103501081466675,
-0.893622100353241,
0.16608655452728271,
-0.37604111433029175,
-1.0817089080810547,
1.3971045017242432,
-0.09940115362405777,
-0.9245296716690063,
0.36588582396507263,
-0.1681923121213913,
0.40568801760673523,
-0.02344268001616001,
-0.3159283995628... |
javascript/reference/global_objects/function/function/index.md | JavaScript - Global Objects - Function - Examples - Specifying arguments with the Function constructor:
The following code creates a `Function` object that takes two arguments.
Example:
// Example can be run directly in your JavaScript console
// Create a function that takes two arguments, and returns the sum of th... | [
-0.2684696316719055,
-0.41734278202056885,
-1.0799376964569092,
1.3776601552963257,
-0.5534157752990723,
-1.530193567276001,
-0.236589252948761,
-0.07635180652141571,
-0.608658492565155,
-0.42208635807037354,
-0.26238083839416504,
0.15280212461948395,
-0.021341970190405846,
-0.125957742333... |
javascript/reference/global_objects/function/function/index.md | JavaScript - Global Objects - Function - Examples - Creating a function object from a function declaration or function expression:
Example:
// The function constructor can take in multiple statements separated by a semicolon. Function expressions require a return statement with the function's name
// Observe that ne... | [
0.39621981978416443,
0.25956618785858154,
-0.5931783318519592,
0.4868133068084717,
0.8859896063804626,
-0.36538559198379517,
-0.7602750062942505,
0.2248808592557907,
-0.4669873118400574,
-0.19016693532466888,
-0.4921794831752777,
0.20621155202388763,
-0.16540896892547607,
0.451565712690353... |
javascript/reference/global_objects/function/prototype/index.md | JavaScript - Global Objects - Function - prototype:
The `prototype` data property of a `Function` instance is used when the function is used as a constructor with the `new` operator. It will become the new object's prototype.
Note: Not all `Function` objects have the `prototype` property — see description. | [
-0.5156177878379822,
-0.40766969323158264,
-1.156002163887024,
0.7869952321052551,
-0.009406683035194874,
-1.4987276792526245,
-0.10122174769639969,
1.2872986793518066,
0.8425210118293762,
0.14456228911876678,
-1.0034098625183105,
-0.45710524916648865,
-0.29618704319000244,
0.0416947305202... |
javascript/reference/global_objects/function/prototype/index.md | JavaScript - Global Objects - Function - prototype - Value:
An object.
Note: Classes are a type of function, so most of the description here applies to the `prototype` property of classes too. The only salient difference is that the `prototype` property of a class is not writable. | [
-0.2178456336259842,
-0.5929774045944214,
-0.0673307403922081,
-0.2574518322944641,
-0.0039106192998588085,
-1.6350387334823608,
-0.042078230530023575,
1.388650894165039,
0.32151174545288086,
-0.5368393063545227,
-0.6287180781364441,
0.11544118076562881,
-0.5875125527381897,
-0.50273936986... |
javascript/reference/global_objects/function/prototype/index.md | JavaScript - Global Objects - Function - prototype - Description:
When a function is called with `new`, the constructor's `prototype` property will become the resulting object's prototype.
Example:
function Ctor() {}
const inst = new Ctor();
console.log(Object.getPrototypeOf(inst) === Ctor.prototype); // true
You c... | [
0.6594040393829346,
0.14906665682792664,
0.12491176277399063,
1.0210613012313843,
0.9662821888923645,
-1.2055686712265015,
0.27526843547821045,
1.2806357145309448,
-0.6084914803504944,
-0.1573657989501953,
-0.7300986051559448,
0.6120204925537109,
-0.21824978291988373,
0.0601905882358551,
... |
javascript/reference/global_objects/function/prototype/index.md | JavaScript - Global Objects - Function - prototype - Examples - Changing the prototype of all instances by mutating the prototype property:
Example:
function Ctor() {}
const p1 = new Ctor();
const p2 = new Ctor();
Ctor.prototype.prop = 1;
console.log(p1.prop); // 1
console.log(p2.prop); // 1 | [
-0.24638500809669495,
-0.12110308557748795,
-0.3049994111061096,
0.6976155042648315,
-0.5904459953308105,
-1.5899235010147095,
-0.458030104637146,
0.3191443383693695,
0.18323346972465515,
0.23919767141342163,
-0.6619154810905457,
-0.08776139467954636,
-0.6025193929672241,
-0.15482665598392... |
javascript/reference/global_objects/function/prototype/index.md | JavaScript - Global Objects - Function - prototype - Examples - Adding a non-method property to a class's prototype property:
Class fields add properties to each instance. Class methods declare function properties on the prototype. However, there's no way to add a non-function property to the prototype. In case you wa... | [
-0.8311846852302551,
-1.1442034244537354,
-0.9042451977729797,
0.790399968624115,
-0.28627726435661316,
-1.0761868953704834,
0.8002025485038757,
0.7269667387008667,
-0.1701681762933731,
-0.3599691390991211,
-0.404911607503891,
-0.13722725212574005,
-0.04061559960246086,
-0.2921957373619079... |
javascript/reference/global_objects/function/length/index.md | JavaScript - Global Objects - Function - length:
The `length` data property of a `Function` instance indicates the number of parameters expected by the function.
Example:
function func1() {}
function func2(a, b) {}
console.log(func1.length);
// Expected output: 0
console.log(func2.length);
// Expected output: 2 | [
-1.211724042892456,
-0.6879417300224304,
-1.7187515497207642,
0.5859155654907227,
-0.4910086393356323,
-1.6078729629516602,
-0.8057715892791748,
0.20696277916431427,
-0.29893261194229126,
-0.7291905283927917,
-0.7762895822525024,
0.4066731631755829,
0.1454673856496811,
0.40120944380760193,... |
javascript/reference/global_objects/function/length/index.md | JavaScript - Global Objects - Function - length - Value:
A number. | [
-0.3288193643093109,
-0.670433521270752,
-1.4824161529541016,
-0.8516407608985901,
-0.834484338760376,
-1.482072353363037,
0.2567303478717804,
0.2603817880153656,
-0.3292340040206909,
-0.7088109850883484,
-0.9971762299537659,
0.07677841186523438,
-0.41260647773742676,
0.14929735660552979,
... |
javascript/reference/global_objects/function/length/index.md | JavaScript - Global Objects - Function - length - Description:
A `Function` object's `length` property indicates how many arguments the function expects, i.e., the number of formal parameters:
- Only parameters before the first one with a default value are counted.
- A destructuring pattern counts as a single paramet... | [
-1.1145986318588257,
-0.743574857711792,
-1.2266066074371338,
0.5067267417907715,
-0.22170664370059967,
-2.0468556880950928,
-0.41606438159942627,
-0.37518808245658875,
-0.40295010805130005,
-0.46061116456985474,
-1.2756177186965942,
0.01071610115468502,
-0.12679889798164368,
0.35135266184... |
javascript/reference/global_objects/function/length/index.md | JavaScript - Global Objects - Function - length - Examples - Using function length:
Example:
console.log(Function.length); // 1
console.log((() => {}).length); // 0
console.log(((a) => {}).length); // 1
console.log(((a, b) => {}).length); // 2 etc.
console.log(((...args) => {}).length);
// 0, rest parameter is not ... | [
-0.22883062064647675,
-0.24944202601909637,
-1.9455420970916748,
0.11431048810482025,
-0.5575689673423767,
-2.030005693435669,
-0.10459796339273453,
-0.2451438009738922,
-0.5904265642166138,
-0.34749045968055725,
0.07663161307573318,
-0.08968976140022278,
0.14912517368793488,
-0.1870366483... |
javascript/reference/global_objects/function/displayname/index.md | JavaScript - Global Objects - Function - displayName:
Non-standard: This feature is not standardized.
The optional `displayName` property of a `Function` instance specifies the display name of the function. | [
-0.8294044137001038,
0.08524870127439499,
-1.3797669410705566,
-0.38091909885406494,
-1.1333917379379272,
-1.1372809410095215,
-0.07696422189474106,
0.6407211422920227,
-0.5192416310310364,
-0.0976942703127861,
-0.4808571934700012,
-0.16811920702457428,
-0.12486958503723145,
0.313885837793... |
javascript/reference/global_objects/function/displayname/index.md | JavaScript - Global Objects - Function - displayName - Value:
The `displayName` property is not initially present on any function — it's added by the code authors. For the purpose of display, it should be a string. | [
-1.1219158172607422,
-0.2771513760089874,
-1.2533327341079712,
-0.227897509932518,
-0.9259325861930847,
-1.0818418264389038,
0.6915410161018372,
0.2882588803768158,
-0.3138158917427063,
-0.44205325841903687,
-0.14505864679813385,
-0.29316312074661255,
-0.7938843965530396,
-0.21440498530864... |
javascript/reference/global_objects/function/displayname/index.md | JavaScript - Global Objects - Function - displayName - Description:
The `displayName` property, if present, may be preferred by consoles and profilers over the `name` property to be displayed as the name of a function.
Among browsers, only the Firefox console utilizes this property. React devtools also use the `displ... | [
-0.18168173730373383,
-0.3533017933368683,
-0.7722630500793457,
0.890597403049469,
0.046068232506513596,
-0.19487924873828888,
0.6238590478897095,
0.3673568069934845,
0.0988326445221901,
0.35340577363967896,
-0.3076234459877014,
-0.05268457904458046,
-0.5644180774688721,
0.1653857678174972... |
javascript/reference/global_objects/function/displayname/index.md | JavaScript - Global Objects - Function - displayName - Examples - Setting a displayName:
By entering the following in a Firefox console, it should display as something like `function MyFunction()`:
Example:
function a() {}
a.displayName = "MyFunction";
a; // function MyFunction() | [
-0.6373909115791321,
-0.05999818444252014,
-1.0545034408569336,
0.355055570602417,
-0.7654131054878235,
-0.4016241729259491,
0.28609079122543335,
0.5421011447906494,
-0.12863221764564514,
0.1499858796596527,
0.05344667285680771,
-0.23365509510040283,
-0.8111732006072998,
-0.224076405167579... |
javascript/reference/global_objects/function/displayname/index.md | JavaScript - Global Objects - Function - displayName - Examples - Changing displayName dynamically:
You can dynamically change the `displayName` of a function:
Example:
const object = {
// anonymous
someMethod: function someMethod(value) {
someMethod.displayName = `someMethod (${value})`;
},
};
console.lo... | [
-0.498842716217041,
-0.4505392909049988,
-0.6687148809432983,
-0.38210365176200867,
-0.6937310099601746,
-1.6174633502960205,
0.1499093770980835,
0.00708202738314867,
-0.07913524657487869,
-0.4940831959247589,
0.05176442861557007,
-0.35411134362220764,
-0.4983578026294708,
-0.4382433295249... |
javascript/reference/global_objects/function/displayname/index.md | JavaScript - Global Objects - Function - displayName - Examples - Cleaning of displayName:
Firefox devtools would clean up a few common patterns in the `displayName` property before displaying it.
Example:
function foo() {}
function testName(name) {
foo.displayName = name;
console.log(foo);
}
testName("$foo$")... | [
-0.7716633081436157,
-0.25596708059310913,
-1.205357313156128,
-0.00509642343968153,
-0.5781456828117371,
-1.1016443967819214,
0.6458577513694763,
0.2745518386363983,
-1.1160916090011597,
0.4763895273208618,
-0.001618557726033032,
-0.058463361114263535,
-1.083019733428955,
-0.4845109581947... |
javascript/reference/global_objects/function/symbol.hasinstance/index.md | JavaScript - Global Objects - Function - Symbol.hasInstance:
The `[Symbol.hasInstance]()` method of `Function` instances specifies the default procedure for determining if a constructor function recognizes an object as one of the constructor's instances. It is called by the `instanceof` operator. | [
-0.338539183139801,
-0.8127395510673523,
-0.7863155007362366,
0.9657328724861145,
0.1336113065481186,
-1.5647319555282593,
-0.07041838765144348,
0.45935049653053284,
0.41008254885673523,
0.33390986919403076,
-0.9406929612159729,
-0.5026554465293884,
0.8442150950431824,
0.8172565698623657,
... |
javascript/reference/global_objects/function/symbol.hasinstance/index.md | JavaScript - Global Objects - Function - Symbol.hasInstance - Syntax:
Example:
func[Symbol.hasInstance](value) | [
-0.028818095102906227,
-0.046437181532382965,
-0.723588764667511,
-0.037989430129528046,
-0.6789100766181946,
-1.5165221691131592,
0.2213694304227829,
1.6597484350204468,
0.3344285786151886,
-0.45616140961647034,
-0.27270960807800293,
0.33056899905204773,
0.5113347172737122,
0.225546196103... |
javascript/reference/global_objects/function/symbol.hasinstance/index.md | JavaScript - Global Objects - Function - Symbol.hasInstance - Syntax - Parameters:
- `value`: The object to test. Primitive values always return `false`. | [
-0.4545956552028656,
-0.12249304354190826,
-0.8041297197341919,
-0.49535712599754333,
-0.17091257870197296,
-1.7358661890029907,
0.8326135873794556,
0.9255927205085754,
-0.07916723191738129,
0.0777679830789566,
-1.7906101942062378,
0.04847220703959465,
0.3286503553390503,
0.470567256212234... |
javascript/reference/global_objects/function/symbol.hasinstance/index.md | JavaScript - Global Objects - Function - Symbol.hasInstance - Syntax - Return value:
`true` if `func.prototype` is in the prototype chain of `value`; otherwise, `false`. Always returns `false` if `value` is not an object or `this` is not a function. If `this` is a bound function, returns the result of an `instanceof` ... | [
-0.9758360981941223,
-0.22170382738113403,
-0.2168644517660141,
0.056267380714416504,
-0.44040822982788086,
-1.2980791330337524,
0.3582873046398163,
0.9722051024436951,
-0.5549989342689514,
0.09296184778213501,
-0.7765886187553406,
0.5906175971031189,
0.9220982193946838,
0.2149976193904876... |
javascript/reference/global_objects/function/symbol.hasinstance/index.md | JavaScript - Global Objects - Function - Symbol.hasInstance - Syntax - Exceptions:
- `TypeError`: Thrown if `this` is not a bound function and `this.prototype` is not an object. | [
-0.7573288083076477,
-0.316704660654068,
-0.19977819919586182,
0.12777093052864075,
-0.7023223042488098,
-1.442161202430725,
-0.36378544569015503,
1.443091630935669,
-0.1279781311750412,
-0.5069500207901001,
-1.0650311708450317,
-0.015430432744324207,
0.18877501785755157,
-0.38927316665649... |
javascript/reference/global_objects/function/symbol.hasinstance/index.md | JavaScript - Global Objects - Function - Symbol.hasInstance - Description:
The `instanceof` operator calls the `[Symbol.hasInstance]()` method of the right-hand side whenever such a method exists. Because all functions inherit from `Function.prototype` by default, they would all have the `[Symbol.hasInstance]()` metho... | [
-0.6972317695617676,
-0.3269321620464325,
-0.7819337844848633,
0.17312704026699066,
-0.2015600949525833,
-0.5313081741333008,
0.30759620666503906,
1.3671188354492188,
0.49122539162635803,
-0.23305250704288483,
-1.3529298305511475,
-0.12842155992984772,
0.6000762581825256,
0.32322958111763,... |
javascript/reference/global_objects/function/symbol.hasinstance/index.md | JavaScript - Global Objects - Function - Symbol.hasInstance - Examples - Reverting to default instanceof behavior:
You would rarely need to call this method directly. Instead, this method is called by the `instanceof` operator. You should expect the two results to usually be equivalent.
Example:
class Foo {}
const f... | [
-0.1364315152168274,
-0.4870426058769226,
-0.5479658842086792,
0.5329692959785461,
-0.3762354850769043,
-1.419318675994873,
0.08375126123428345,
0.45657411217689514,
-0.47861212491989136,
0.14750410616397858,
-0.7654150128364563,
-0.22744862735271454,
0.47197863459587097,
0.628006458282470... |
javascript/reference/global_objects/function/apply/index.md | JavaScript - Global Objects - Function - apply:
The `apply()` method of `Function` instances calls this function with a given `this` value, and `arguments` provided as an array (or an array-like object).
Example:
const numbers = [5, 6, 2, 3, 7];
const max = Math.max.apply(null, numbers);
console.log(max);
// Expec... | [
-0.026561452075839043,
-0.32818305492401123,
-1.117443561553955,
0.9949592351913452,
-0.25657328963279724,
-0.9845446348190308,
-0.21003179252147675,
0.23703952133655548,
-0.08220982551574707,
-0.18585731089115143,
-0.9285070896148682,
0.49243080615997314,
0.10216553509235382,
0.3795585632... |
javascript/reference/global_objects/function/apply/index.md | JavaScript - Global Objects - Function - apply - Syntax:
Example:
apply(thisArg)
apply(thisArg, argsArray) | [
-0.4021923243999481,
0.5509300231933594,
-0.5344461798667908,
0.2198532223701477,
-0.8709743022918701,
-2.046635150909424,
0.4037085175514221,
0.8344417810440063,
0.043280769139528275,
-0.6846883893013,
-0.9290651082992554,
-0.0048721483908593655,
-0.1275143176317215,
0.30827996134757996,
... |
javascript/reference/global_objects/function/apply/index.md | JavaScript - Global Objects - Function - apply - Syntax - Parameters:
- `thisArg`: The value of `this` provided for the call to `func`. If the function is not in strict mode, `null` and `undefined` will be replaced with the global object, and primitive values will be converted to objects.
- `argsArray` (optional): An ... | [
-0.662662923336029,
-0.014073794707655907,
-0.5614777207374573,
0.43863099813461304,
-0.7161462903022766,
-2.2360317707061768,
0.6224190592765808,
0.37655341625213623,
0.29660531878471375,
-0.16348592936992645,
-1.0889866352081299,
-0.20668530464172363,
-0.0589725524187088,
0.7053474783897... |
javascript/reference/global_objects/function/apply/index.md | JavaScript - Global Objects - Function - apply - Syntax - Return value:
The result of calling the function with the specified `this` value and arguments. | [
-0.007438132539391518,
0.047105949372053146,
-0.9634327292442322,
0.09520812332630157,
-0.852425217628479,
-1.6480774879455566,
0.22128693759441376,
0.5813896059989929,
0.1855834722518921,
-0.36104828119277954,
-0.9346014857292175,
1.0083779096603394,
0.03956648334860802,
1.027457714080810... |
javascript/reference/global_objects/function/apply/index.md | JavaScript - Global Objects - Function - apply - Description:
Note: This function is almost identical to `call()`, except that the function arguments are passed to `call()` individually as a list, while for `apply()` they are combined in one object, typically an array — for example, `func.call(this, "eat", "bananas")`... | [
-0.19647552073001862,
0.19534848630428314,
-0.6458989977836609,
0.8011312484741211,
0.39401304721832275,
-0.8459896445274353,
-0.1354341357946396,
0.5346387624740601,
-0.5893927812576294,
-0.34024757146835327,
-0.6701024174690247,
0.38544195890426636,
-0.05865742638707161,
0.41316771507263... |
javascript/reference/global_objects/function/apply/index.md | JavaScript - Global Objects - Function - apply - Examples - Using apply() to append an array to another:
You can use `Array.prototype.push()` to append an element to an array. Because `push()` accepts a variable number of arguments, you can also push multiple elements at once. But if you pass an array to `push()`, it ... | [
-0.0748862475156784,
0.6631461381912231,
-0.8636756539344788,
0.8133717775344849,
0.10333533585071564,
-0.6407089233398438,
0.03642212972044945,
0.1933431327342987,
-0.17444324493408203,
-0.16451703011989594,
-0.6042913198471069,
0.5126992464065552,
0.011879045516252518,
0.7038314938545227... |
javascript/reference/global_objects/function/apply/index.md | JavaScript - Global Objects - Function - apply - Examples - Using apply() and built-in functions:
Clever usage of `apply()` allows you to use built-in functions for some tasks that would probably otherwise require manually looping over a collection (or using the spread syntax).
For example, we can use `Math.max()` an... | [
0.525506317615509,
0.47075343132019043,
-1.2032794952392578,
0.8714327216148376,
0.5173822045326233,
-0.8841383457183838,
-0.3350938558578491,
0.6468459963798523,
-0.5824596285820007,
-0.2700430452823639,
-0.5440371632575989,
0.7302066683769226,
-0.20035338401794434,
0.4068520963191986,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.