file stringlengths 16 94 | text stringlengths 32 24.4k | vector list |
|---|---|---|
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas:
Trailing commas (sometimes called "final commas") can be useful when adding new elements, parameters, or properties to JavaScript code. If you want to add a new property, you can add a new line without modifying the previously last line if that line already uses a trailing comma. This mak... | [
-0.0682787150144577,
-0.007575904484838247,
-0.7048292756080627,
1.094356894493103,
0.6937423348426819,
-1.0430389642715454,
0.7484753131866455,
1.1760673522949219,
-1.237807273864746,
0.7541407346725464,
-1.0919935703277588,
-0.1161048412322998,
-0.4440934658050537,
0.04445117339491844,
... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Description:
JavaScript allows trailing commas wherever a comma-separated list of values is accepted and more values may be expected after the last item. This includes:
- Array literals
- Object literals
- Parameter definitions
- Function calls
- Named imports
- Named exports
- Dynamic ... | [
-0.04054136574268341,
-0.6873224377632141,
-1.2854554653167725,
1.0670658349990845,
0.6215736865997314,
-0.9451743960380554,
1.050611138343811,
1.120733618736267,
-1.36411452293396,
0.7539104223251343,
-1.040175437927246,
-0.2458888292312622,
-0.5003993511199951,
0.2593637704849243,
-1.0... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in literals - Arrays:
JavaScript ignores trailing commas in array literals:
Example:
const arr = [
1,
2,
3,
];
arr; // [1, 2, 3]
arr.length; // 3
If more than one trailing comma is used, an elision (or hole) is produced. An array with holes is called ... | [
-0.32162168622016907,
0.17564181983470917,
-0.4885791540145874,
0.6882855892181396,
0.5022029280662537,
-0.8831771016120911,
0.4852607846260071,
1.257264256477356,
-1.7462832927703857,
0.4038674235343933,
-0.4958083927631378,
-0.005303428042680025,
-0.3754475712776184,
-0.39885035157203674... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in literals - Objects:
Trailing commas in object literals are legal as well:
Example:
const object = {
foo: "bar",
baz: "qwerty",
age: 42,
}; | [
0.13096700608730316,
0.6345979571342468,
-0.5806459188461304,
-0.11246398091316223,
-0.11643803864717484,
-0.475971519947052,
-0.2301415055990219,
1.1232625246047974,
-0.9715880751609802,
0.19354481995105743,
-1.1391679048538208,
-0.2107512503862381,
-0.4635981321334839,
-0.956731915473938... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in functions:
Trailing commas are also allowed in function parameter lists. | [
0.28876540064811707,
0.2408589869737625,
-1.1657615900039673,
0.7084971070289612,
0.29002436995506287,
-0.49576690793037415,
0.11762971431016922,
2.079378843307495,
-1.6663309335708618,
0.30291634798049927,
-1.1060696840286255,
-0.6056510210037231,
0.4760577976703644,
-0.6671903133392334,
... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in functions - Parameter definitions:
The following function definition pairs are legal and equivalent to each other. Trailing commas don't affect the `length` property of function declarations or their `arguments` object.
Example:
function f(p) {}
function f... | [
-0.3427359461784363,
-0.08601975440979004,
-1.239151120185852,
0.6110911965370178,
0.1831233650445938,
-1.0226017236709595,
0.7956012487411499,
1.804282546043396,
-0.9599299430847168,
-0.05842706933617592,
-0.9982223510742188,
-0.34744760394096375,
0.1720472127199173,
-0.8089590072631836,
... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in functions - Function calls:
The following function invocation pairs are legal and equivalent to each other.
Example:
f(p);
f(p,);
Math.max(10, 20);
Math.max(10, 20,); | [
-0.08268830925226212,
0.32312697172164917,
-0.9293838739395142,
0.7365310192108154,
0.02918579988181591,
-0.5160174369812012,
0.7092247009277344,
1.360873818397522,
-1.2611654996871948,
0.3496973216533661,
-1.0505458116531372,
0.29263120889663696,
-0.1761588603258133,
-0.7597421407699585,
... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in functions - Illegal trailing commas:
Function parameter definitions or function invocations only containing a comma will throw a `SyntaxError`. Furthermore, when using rest parameters, trailing commas are not allowed:
Example:
function f(,) {} // SyntaxErr... | [
-0.11978404223918915,
0.3286401629447937,
-1.215713381767273,
0.64603590965271,
0.27686986327171326,
-1.1769708395004272,
-0.14442461729049683,
1.8975740671157837,
-1.67286217212677,
0.3828365206718445,
-0.6741082668304443,
0.02298908494412899,
0.05525762215256691,
-0.3886556923389435,
-... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in destructuring:
A trailing comma is also allowed within a destructuring pattern:
Example:
// array destructuring with trailing comma
[a, b,] = [1, 2];
// object destructuring with trailing comma
const o = {
p: 42,
q: true,
};
const { p, q, } = o;
Howe... | [
0.5357369184494019,
0.33974525332450867,
-0.7907871603965759,
0.403852641582489,
0.058518122881650925,
-1.2839754819869995,
0.1253546178340912,
1.3360832929611206,
-1.772587537765503,
0.5307164192199707,
-0.6437256932258606,
-0.6202622652053833,
0.1280764490365982,
-0.16582374274730682,
... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in JSON:
As JSON is based on a very restricted subset of JavaScript syntax, trailing commas are not allowed in JSON.
Both lines will throw a `SyntaxError`:
Example:
JSON.parse("[1, 2, 3, 4, ]");
JSON.parse('{"foo" : 1, }');
// SyntaxError JSON.parse: unexpec... | [
0.019461151212453842,
0.21789003908634186,
-1.0901001691818237,
-0.05514514073729515,
0.5478277802467346,
-1.0340416431427002,
0.17525650560855865,
1.7818869352340698,
-2.0042359828948975,
0.5059840083122253,
-0.6144996881484985,
0.14432471990585327,
0.06104397028684616,
-0.622699677944183... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in named imports and named exports:
Trailing commas are valid in named imports and named exports. | [
0.3535221815109253,
0.23548439145088196,
-0.5146717429161072,
1.4364049434661865,
0.03364189714193344,
-0.3120877742767334,
0.560110330581665,
1.554565191268921,
-1.3765349388122559,
0.86444491147995,
-0.8681597709655762,
-0.3831231892108917,
-0.7088253498077393,
-0.30989786982536316,
-1... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in named imports and named exports - Named imports:
Example:
import {
A,
B,
C,
} from "D";
import { X, Y, Z, } from "W";
import { A as B, C as D, E as F, } from "Z"; | [
0.3713180720806122,
0.1504574418067932,
-1.0996911525726318,
1.0823520421981812,
0.02412606216967106,
-0.2282353639602661,
0.3997700810432434,
1.606513261795044,
-1.6450737714767456,
0.7736324667930603,
-0.7453336715698242,
-0.5735094547271729,
-0.35264885425567627,
-0.46767622232437134,
... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in named imports and named exports - Named exports:
Example:
export {
A,
B,
C,
};
export { A, B, C, };
export { A as B, C as D, E as F, }; | [
0.2886444330215454,
0.17680513858795166,
-1.0141143798828125,
1.1959071159362793,
0.09915027022361755,
-0.1483316868543625,
-0.11503525078296661,
2.0640833377838135,
-1.7547459602355957,
0.8089356422424316,
-1.0148102045059204,
-0.21407145261764526,
-0.25518760085105896,
-0.427598059177398... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Trailing commas in dynamic import:
Trailing commas are only allowed in dynamic imports if the runtime also implements the second `options` parameter.
Example:
import("D",);
import(
"D",
{ with: { type: "json" } },
); | [
-0.34502649307250977,
-0.18593019247055054,
-0.6558780670166016,
1.2142853736877441,
-0.035286739468574524,
0.10520131140947342,
0.3479604423046112,
2.033186912536621,
-1.6267871856689453,
1.3602465391159058,
-0.6528745293617249,
-0.9168220162391663,
0.6022692918777466,
-0.5934218764305115... |
javascript/reference/trailing_commas/index.md | JavaScript - Trailing commas - Examples - Quantifier prefix:
Note: The trailing comma in a quantifier actually changes its semantics from matching "exactly `n`" to matching "at least `n`".
Example:
/x{2}/; // Exactly 2 occurrences of "x"; equivalent to /xx/
/x{2,}/; // At least 2 occurrences of "x"; equivalent to /x... | [
-0.6628767848014832,
0.6093724370002747,
-1.0107507705688477,
0.7476565837860107,
-0.5076755285263062,
-1.1653056144714355,
0.260408490896225,
1.5413345098495483,
-1.650835394859314,
0.18878397345542908,
-0.7184427976608276,
-0.8716816306114197,
-0.5367658734321594,
0.1627887487411499,
0... |
javascript/reference/errors/index.md | JavaScript - Errors:
Below, you'll find a list of errors which are thrown by JavaScript. These errors can be a helpful debugging aid, but the reported problem isn't always immediately clear. The pages below will provide additional details about these errors. Each error is an object based upon the `Error` object, and h... | [
0.601365327835083,
-0.5057848691940308,
-1.4893085956573486,
0.1088099330663681,
-0.26895859837532043,
-1.247959852218628,
1.004993200302124,
0.5199264883995056,
-1.0255117416381836,
-0.5065039396286011,
-0.5260563492774963,
0.0009413079242222011,
-0.1449137032032013,
0.4854641258716583,
... |
javascript/reference/errors/index.md | JavaScript - Errors - List of errors:
In this list, each page is listed by name (the type of error) and message (a more detailed human-readable error message). Together, these two properties provide a starting point toward understanding and resolving the error. For more information, follow the links below! | [
0.41973960399627686,
-0.9794245362281799,
-1.121457576751709,
-0.6836150288581848,
0.10654036700725555,
-0.6617229580879211,
1.8985217809677124,
0.758117139339447,
-0.22691623866558075,
-0.13181902468204498,
-0.09356901794672012,
-0.22143186628818512,
0.353897362947464,
0.27253592014312744... |
javascript/reference/errors/regex_invalid_unicode_escape/index.md | JavaScript - Errors - Regex invalid unicode escape:
The JavaScript exception "invalid unicode escape in regular expression" occurs when the `\c` and `\u` character escapes are not followed by valid characters. | [
-0.25259241461753845,
0.19775645434856415,
-1.0801737308502197,
-0.272718220949173,
0.41754525899887085,
-0.4603464603424072,
0.4782788157463074,
0.19874078035354614,
-0.8303658962249756,
-0.5369550585746765,
-0.4853939414024353,
-1.4567912817001343,
-0.05582123622298241,
-0.57954859733581... |
javascript/reference/errors/regex_invalid_unicode_escape/index.md | JavaScript - Errors - Regex invalid unicode escape - Message:
Example:
SyntaxError: Invalid regular expression: /\u{123456}/u: Invalid Unicode escape (V8-based)
SyntaxError: invalid unicode escape in regular expression (Firefox)
SyntaxError: Invalid regular expression: invalid Unicode code point \u{} escape (Safari) | [
-0.1989286243915558,
0.5475329756736755,
-1.1665728092193604,
-0.6211447715759277,
0.18113580346107483,
-1.0186830759048462,
0.6267052292823792,
0.864963173866272,
-0.3495253324508667,
-0.5735720992088318,
-0.03936309739947319,
-0.6479330658912659,
-0.3309745788574219,
-0.8235636949539185,... |
javascript/reference/errors/regex_invalid_unicode_escape/index.md | JavaScript - Errors - Regex invalid unicode escape - Error type:
`SyntaxError` | [
-0.13603046536445618,
0.5254409909248352,
-0.21725820004940033,
-0.4179754853248596,
-0.4397593140602112,
-0.5588624477386475,
0.8669923543930054,
1.6174877882003784,
-0.31421780586242676,
-1.1240348815917969,
0.07490918040275574,
-0.6366111636161804,
-0.12197305262088776,
-0.2854599654674... |
javascript/reference/errors/regex_invalid_unicode_escape/index.md | JavaScript - Errors - Regex invalid unicode escape - What went wrong?:
In Unicode-aware mode mode, the `\c` escape sequence must be followed by a letter from `A` to `Z` or `a` to `z`, and the `\u` escape sequence must either be followed by 4 hexadecimal digits, or 1 to 6 hexadecimal digits enclosed in curly braces (`{... | [
-0.6501933336257935,
0.0804816409945488,
-1.0088824033737183,
-0.506243109703064,
0.1784057319164276,
-0.3871254622936249,
0.11821670830249786,
0.07406735420227051,
-0.6402526497840881,
-0.3418940007686615,
-0.6277526617050171,
-0.42739033699035645,
0.1210877001285553,
-0.3691895008087158,... |
javascript/reference/errors/regex_invalid_unicode_escape/index.md | JavaScript - Errors - Regex invalid unicode escape - Examples - Invalid cases:
Example:
/\u{123456}/u; // Unicode code point is too large
/\u65/u; // Not enough digits
/\c1/u; // Not a letter | [
0.2601131498813629,
0.5674570798873901,
-1.1268154382705688,
-0.4546039402484894,
0.27809229493141174,
-0.6904478073120117,
0.052509330213069916,
0.620187520980835,
-0.5473708510398865,
-0.7016775012016296,
-0.2261824905872345,
-0.38793760538101196,
-0.36552897095680237,
-0.499559789896011... |
javascript/reference/errors/regex_invalid_unicode_escape/index.md | JavaScript - Errors - Regex invalid unicode escape - Examples - Valid cases:
Example:
/\u0065/u; // Lowercase "e"
/\u{1f600}/u; // Grinning face emoji
/\cA/u; // U+0001 (Start of Heading) | [
-0.3950894773006439,
0.8509325981140137,
-0.4560803174972534,
-0.22337639331817627,
-0.10305582731962204,
-0.30923089385032654,
0.3480026125907898,
0.8374739289283752,
-1.0301260948181152,
-0.2347620576620102,
-0.8015615940093994,
-0.8961604833602905,
-0.3399116098880768,
-0.59278684854507... |
javascript/reference/errors/missing_colon_after_property_id/index.md | JavaScript - Errors - Missing colon after property id:
The JavaScript exception "missing : after property id" occurs when objects are created using the object initializer syntax. A colon (`:`) separates keys and values for the object's properties. Somehow, this colon is missing or misplaced. | [
0.048417747020721436,
-0.6489412188529968,
-0.9441428780555725,
0.7832334637641907,
-0.024134891107678413,
-0.9791504740715027,
0.5872412323951721,
1.0397363901138306,
-1.4862624406814575,
-0.14039583504199982,
-0.09507900476455688,
-1.0856401920318604,
-1.3685582876205444,
-0.155850723385... |
javascript/reference/errors/missing_colon_after_property_id/index.md | JavaScript - Errors - Missing colon after property id - Message:
Example:
SyntaxError: Invalid shorthand property initializer (V8-based)
SyntaxError: missing : after property id (Firefox)
SyntaxError: Unexpected token '='. Expected a ':' following the property name 'x'. (Safari)
SyntaxError: Unexpected token '+'. Exp... | [
-0.8061898350715637,
-0.015342450700700283,
-1.1414387226104736,
0.16169776022434235,
-0.6105268597602844,
-0.8678939342498779,
0.8281605839729309,
1.2148213386535645,
-1.1654706001281738,
-0.11109901964664459,
0.47555628418922424,
-0.6179381608963013,
-1.5791208744049072,
-0.6912077665328... |
javascript/reference/errors/missing_colon_after_property_id/index.md | JavaScript - Errors - Missing colon after property id - Error type:
`SyntaxError` | [
-0.4906326234340668,
-0.02748507633805275,
-0.3141867518424988,
-0.3712330758571625,
-0.750417947769165,
-0.576996386051178,
0.629115879535675,
1.4621937274932861,
-1.515633463859558,
-0.6524423360824585,
0.8081499934196472,
-0.6772180199623108,
-1.2670177221298218,
-0.22678250074386597,
... |
javascript/reference/errors/missing_colon_after_property_id/index.md | JavaScript - Errors - Missing colon after property id - What went wrong?:
When creating objects with the object initializer syntax, a colon (`:`) separates keys and values for the object's properties.
Example:
const obj = { propertyKey: "value" }; | [
0.33775368332862854,
-0.25949275493621826,
-1.01170015335083,
0.2918638586997986,
-0.18663892149925232,
-0.7647539377212524,
-0.2830294370651245,
1.3863918781280518,
-1.2348719835281372,
0.022783223539590836,
0.3853422999382019,
-0.7537807822227478,
-0.8608032464981079,
-0.3468040227890014... |
javascript/reference/errors/missing_colon_after_property_id/index.md | JavaScript - Errors - Missing colon after property id - Examples - Colons vs. equal signs:
This code fails, as the equal sign can't be used this way in this object initializer syntax.
Example:
const obj = { propertyKey = "value" };
// SyntaxError: missing : after property id
Correct would be to use a colon, or to u... | [
0.19487464427947998,
0.34150877594947815,
-0.9237877726554871,
0.3121144771575928,
-0.16768652200698853,
-1.0290319919586182,
0.537674605846405,
0.8495901823043823,
-1.2202067375183105,
-0.07752659171819687,
0.2048911154270172,
-0.5130770802497864,
-0.5633189678192139,
-0.27566200494766235... |
javascript/reference/errors/missing_colon_after_property_id/index.md | JavaScript - Errors - Missing colon after property id - Examples - Computed properties:
If you create a property key from an expression, you need to use square brackets. Otherwise the property name can't be computed:
Example:
const obj = { "b"+"ar": "foo" };
// SyntaxError: missing : after property id
Put the expre... | [
0.15972554683685303,
0.09063423424959183,
-0.9674069285392761,
0.30845755338668823,
-0.04444057494401932,
-1.1345924139022827,
1.08768892288208,
0.4305504560470581,
-0.85600346326828,
-0.08613986521959305,
-0.0075777810998260975,
-0.17771635949611664,
-0.9717709422111511,
-0.73565292358398... |
javascript/reference/errors/is_not_iterable/index.md | JavaScript - Errors - is not iterable:
The JavaScript exception "is not iterable" occurs when the value which is spread into an array or function call, given as the right-hand side of `for...of`, as argument of a function such as `Promise.all` or `Set()`, or as the right-hand side of an array destructuring, is not an ... | [
-0.1939232349395752,
0.12548577785491943,
-0.5564072728157043,
0.6725142598152161,
-0.6163657307624817,
-1.3028209209442139,
0.16009478271007538,
1.3963959217071533,
-0.6863095164299011,
0.00952960830181837,
-0.13306087255477905,
-0.07975248247385025,
-0.3888198137283325,
-0.34067514538764... |
javascript/reference/errors/is_not_iterable/index.md | JavaScript - Errors - is not iterable - Message:
Example:
TypeError: Spread syntax requires ...iterable[Symbol.iterator] to be a function (V8-based & Safari)
TypeError: %Array%.from requires that the property of the first argument, items[Symbol.iterator], when exists, be a function (V8-based & Safari)
TypeError: Arra... | [
-0.21650516986846924,
-0.12070870399475098,
-1.129973292350769,
0.08623629808425903,
-0.32876473665237427,
-0.5190569162368774,
-0.23547257483005524,
1.2340753078460693,
-0.2571479380130768,
-0.28190383315086365,
-0.1761750727891922,
-0.31806468963623047,
-0.5464004278182983,
-0.7338270545... |
javascript/reference/errors/is_not_iterable/index.md | JavaScript - Errors - is not iterable - Error type:
`TypeError` | [
-0.19271554052829742,
0.49885430932044983,
-0.6035778522491455,
-0.5682711601257324,
-0.6879833936691284,
0.49313583970069885,
0.9179298281669617,
2.0006816387176514,
-0.7827776074409485,
-0.5593116879463196,
0.048232272267341614,
-0.3287190794944763,
0.20991697907447815,
-0.31829354166984... |
javascript/reference/errors/is_not_iterable/index.md | JavaScript - Errors - is not iterable - What went wrong?:
The value which is spread into an array or function call, given as the right-hand side of `for...of`, or as argument of a function such as `Promise.all` or `Set()`, or as the source of an array destructuring pattern, is not an iterable object. An iterable can b... | [
0.3276057839393616,
0.2933492064476013,
-0.45271989703178406,
0.3753748834133148,
0.6328810453414917,
-1.0667896270751953,
0.12772276997566223,
1.1056129932403564,
0.15578529238700867,
-0.48044079542160034,
-0.06890273094177246,
-0.044914402067661285,
0.21512337028980255,
-0.11387376487255... |
javascript/reference/errors/is_not_iterable/index.md | JavaScript - Errors - is not iterable - Examples - Array destructuring a non-iterable:
Example:
const myObj = { arrayOrObjProp1: {}, arrayOrObjProp2: [42] };
const {
arrayOrObjProp1: [value1],
arrayOrObjProp2: [value2],
} = myObj; // TypeError: object is not iterable
console.log(value1, value2);
The non-iterab... | [
-0.1683141142129898,
0.332698255777359,
-0.5184617638587952,
0.6514086127281189,
-0.38173407316207886,
-0.7546718716621399,
-0.4469655752182007,
0.9009996652603149,
0.041782017797231674,
-0.02444477751851082,
0.19910316169261932,
-0.9338836073875427,
-0.04601293429732323,
-0.70275980234146... |
javascript/reference/errors/is_not_iterable/index.md | JavaScript - Errors - is not iterable - Examples - Iterating over Object properties:
In JavaScript, `Object`s are not iterable unless they implement the iterable protocol. Therefore, you cannot use `for...of` to iterate over the properties of an object.
Example:
const obj = { France: "Paris", England: "London" };
fo... | [
0.0317440889775753,
0.09663327038288116,
-0.069527268409729,
-0.011530221439898014,
0.7753125429153442,
-0.6360892057418823,
0.7696000337600708,
0.4601436257362366,
-0.5481283068656921,
-0.1990017294883728,
0.1240612044930458,
0.6878765225410461,
-0.15408343076705933,
0.3125826418399811,
... |
javascript/reference/errors/is_not_iterable/index.md | JavaScript - Errors - is not iterable - Examples - Iterating over a generator:
Generator functions are functions you call to produce an iterable object.
Example:
function* generate(a, b) {
yield a;
yield b;
}
for (const x of generate) {
console.log(x);
} // TypeError: generate is not iterable
When they are n... | [
0.4881192147731781,
0.12618841230869293,
-1.0898592472076416,
0.5731459259986877,
0.15239280462265015,
-1.0896621942520142,
0.12679345905780792,
0.6479047536849976,
-0.25707191228866577,
0.4001118838787079,
-0.04452267661690712,
-0.03277052938938141,
0.10963254421949387,
-0.166875153779983... |
javascript/reference/errors/is_not_iterable/index.md | JavaScript - Errors - is not iterable - Examples - Iterating over a custom iterable:
Custom iterables can be created by implementing the `Symbol.iterator` method. You must be certain that your iterator method returns an object which is an iterator, which is to say it must have a next method.
Example:
const myEmptyIt... | [
-0.12918920814990997,
-0.03894450515508652,
-0.04290207847952843,
0.8892114758491516,
0.1899309903383255,
-1.3786594867706299,
-0.09932325780391693,
1.1620765924453735,
-0.7619145512580872,
0.6056743264198303,
-0.04589730501174927,
0.3724978268146515,
-0.894629955291748,
-0.214551419019699... |
javascript/reference/errors/missing_parenthesis_after_argument_list/index.md | JavaScript - Errors - Missing parenthesis after argument list:
The JavaScript exception "missing ) after argument list" occurs when there is an error with how a function is called. This might be a typo, a missing operator, or an unescaped string. | [
-0.4442368149757385,
-0.8581491112709045,
-0.9491229057312012,
0.5069980025291443,
0.1796635240316391,
-1.825158953666687,
1.16496741771698,
0.749972939491272,
-1.2743635177612305,
0.5510267019271851,
-0.011865091510117054,
-1.2159366607666016,
-0.9408900141716003,
0.2242540568113327,
-0... |
javascript/reference/errors/missing_parenthesis_after_argument_list/index.md | JavaScript - Errors - Missing parenthesis after argument list - Message:
Example:
SyntaxError: missing ) after argument list (V8-based & Firefox)
SyntaxError: Unexpected identifier 'x'. Expected ')' to end an argument list. (Safari) | [
-0.5494610071182251,
-0.4562092423439026,
-1.225675344467163,
0.174496591091156,
-0.7833438515663147,
-2.0324795246124268,
1.2715398073196411,
1.0202372074127197,
-0.15652570128440857,
0.5535451769828796,
0.9778720736503601,
-0.40986835956573486,
-0.5832381844520569,
-0.15331368148326874,
... |
javascript/reference/errors/missing_parenthesis_after_argument_list/index.md | JavaScript - Errors - Missing parenthesis after argument list - Error type:
`SyntaxError`. | [
-0.6365044713020325,
-0.33073315024375916,
-0.3123469650745392,
-0.3721804916858673,
-0.29004037380218506,
-1.2509418725967407,
1.2173652648925781,
1.9715280532836914,
-0.22743329405784607,
-0.6456771492958069,
0.8572231531143188,
-0.6146437525749207,
-0.666064441204071,
-0.276226013898849... |
javascript/reference/errors/missing_parenthesis_after_argument_list/index.md | JavaScript - Errors - Missing parenthesis after argument list - What went wrong?:
There is an error with how a function is called. This might be a typo, a missing operator, or an unescaped string, for example. | [
-0.02587675116956234,
-0.03712965548038483,
-1.2301678657531738,
-0.30381542444229126,
0.3583580255508423,
-1.5240548849105835,
0.7109085917472839,
1.343523383140564,
-1.172111988067627,
0.15779376029968262,
-0.34327372908592224,
-1.239594578742981,
-0.5992470979690552,
0.03672380000352859... |
javascript/reference/errors/missing_parenthesis_after_argument_list/index.md | JavaScript - Errors - Missing parenthesis after argument list - Examples:
Because there is no "+" operator to concatenate the string, JavaScript expects the argument for the `log` function to be just `"PI: "`. In that case, it should be terminated by a closing parenthesis.
Example:
console.log("PI: " Math.PI);
// Sy... | [
-0.7018307447433472,
-0.6973925232887268,
-0.811708390712738,
0.8377565145492554,
0.10581914335489273,
-1.320829153060913,
0.8874586820602417,
0.8648372292518616,
-0.36342713236808777,
0.3435203731060028,
0.40127530694007874,
-0.5949030518531799,
-0.19329871237277985,
0.24519045650959015,
... |
javascript/reference/errors/missing_parenthesis_after_argument_list/index.md | JavaScript - Errors - Missing parenthesis after argument list - Examples - Unterminated strings:
Example:
console.log('"Java" + "Script" = \"' + "Java" + 'Script\");
// SyntaxError: missing ) after argument list
Here JavaScript thinks that you meant to have `);` inside the string and ignores it, and it ends up not k... | [
-0.6504696011543274,
-0.11900492757558823,
-0.8270742893218994,
0.4501928389072418,
-0.034136924892663956,
-1.8112108707427979,
1.2519999742507935,
0.7237651348114014,
-1.156158685684204,
-0.16483832895755768,
1.0180262327194214,
-0.7973721623420715,
-1.1141654253005981,
0.0648617595434188... |
javascript/reference/errors/requires_global_regexp/index.md | JavaScript - Errors - Requires global RegExp:
The JavaScript exception "TypeError: matchAll/replaceAll must be called with a global RegExp" occurs when the `String.prototype.matchAll()` or `String.prototype.replaceAll()` method is used with a `RegExp` object that does not have the `global` flag set. | [
-0.7186684608459473,
0.1220354437828064,
-0.5089263319969177,
0.011551864445209503,
-0.6215628385543823,
-1.105650782585144,
-0.22525012493133545,
0.44100135564804077,
-0.8647911548614502,
-0.7224878668785095,
-0.5771144032478333,
-0.4595837891101837,
0.16925589740276337,
-0.15147656202316... |
javascript/reference/errors/requires_global_regexp/index.md | JavaScript - Errors - Requires global RegExp - Message:
Example:
TypeError: String.prototype.matchAll called with a non-global RegExp argument (V8-based)
TypeError: String.prototype.replaceAll called with a non-global RegExp argument (V8-based)
TypeError: matchAll must be called with a global RegExp (Firefox)
TypeErr... | [
-0.9312384724617004,
0.3083435893058777,
-0.6194471120834351,
-0.5650601983070374,
-0.4994798004627228,
-0.5559746623039246,
-0.07727472484111786,
0.035773251205682755,
-0.25174325704574585,
-0.2805756628513336,
-0.5483123660087585,
-0.5185431241989136,
-0.06434915959835052,
-0.37239181995... |
javascript/reference/errors/requires_global_regexp/index.md | JavaScript - Errors - Requires global RegExp - Error type:
`TypeError` | [
-0.6675388216972351,
0.2055153101682663,
-0.729227602481842,
-0.6336726546287537,
-0.7011278867721558,
0.5962350368499756,
0.22916024923324585,
0.8475699424743652,
-0.4016287922859192,
-0.8020389676094055,
-0.1437791883945465,
-0.3790205419063568,
0.0510694794356823,
-0.5173468589782715,
... |
javascript/reference/errors/requires_global_regexp/index.md | JavaScript - Errors - Requires global RegExp - What went wrong?:
The `String.prototype.matchAll()` and `String.prototype.replaceAll()` methods require a `RegExp` object with the `global` flag set. This flag indicates that the regular expression can match all locations of the input string, instead of stopping at the fi... | [
-0.6992103457450867,
0.0048654647544026375,
-0.6069034337997437,
-0.396014541387558,
0.3652048408985138,
-1.3358255624771118,
0.19313137233257294,
0.6312279105186462,
-0.5588624477386475,
-0.4564925730228424,
-0.883948802947998,
-0.7498422861099243,
0.48561006784439087,
0.25199106335639954... |
javascript/reference/errors/requires_global_regexp/index.md | JavaScript - Errors - Requires global RegExp - Examples - Invalid cases:
Example:
"abc".matchAll(/./); // TypeError
"abc".replaceAll(/./, "f"); // TypeError | [
-0.06829240918159485,
0.47722679376602173,
-0.7628666162490845,
0.22064276039600372,
-0.02844562940299511,
-0.09427420794963837,
0.0020068178419023752,
0.8210281133651733,
-1.0983288288116455,
-0.2099444717168808,
-0.2027098685503006,
-0.6583762168884277,
0.08204434812068939,
-0.1671955138... |
javascript/reference/errors/requires_global_regexp/index.md | JavaScript - Errors - Requires global RegExp - Examples - Valid cases:
If you intend to do global matching/replacement: either add the `g` flag, or construct a new `RegExp` object with the `g` flag, if you want to keep the original regex unchanged.
Example:
[..."abc".matchAll(/./g)]; // [[ "a" ], [ "b" ], [ "c" ]]
"... | [
-0.5527743697166443,
0.690894365310669,
-0.35606396198272705,
0.6831133365631104,
0.32810738682746887,
-0.7812394499778748,
0.38512080907821655,
0.8273282051086426,
-0.16095852851867676,
-0.26053324341773987,
-0.7451335191726685,
-0.09041621536016464,
0.009247316978871822,
0.28734320402145... |
javascript/reference/errors/missing_curly_after_function_body/index.md | JavaScript - Errors - Missing curly after function body:
The JavaScript exception "missing } after function body" occurs when there is a syntax mistake when creating a function somewhere. Check if any closing curly braces or parenthesis are in the correct order. | [
-1.0198465585708618,
0.29405730962753296,
-0.6220791935920715,
0.30878233909606934,
0.2778153121471405,
-1.1494309902191162,
-0.023988638073205948,
0.5277109742164612,
-1.507232427597046,
-0.5099931359291077,
0.035569023340940475,
-1.2446558475494385,
-0.4883727431297302,
0.280538678169250... |
javascript/reference/errors/missing_curly_after_function_body/index.md | JavaScript - Errors - Missing curly after function body - Message:
Example:
SyntaxError: missing } after function body (Firefox) | [
-1.7804070711135864,
0.726111114025116,
-0.6750554442405701,
-0.545789361000061,
-0.04230548068881035,
-1.1638414859771729,
0.11574839055538177,
0.8530244827270508,
-1.4405145645141602,
-1.0302196741104126,
1.1929895877838135,
-1.1261361837387085,
-0.3003751039505005,
0.10523314774036407,
... |
javascript/reference/errors/missing_curly_after_function_body/index.md | JavaScript - Errors - Missing curly after function body - Error type:
`SyntaxError` | [
-1.756833553314209,
0.7137277722358704,
-0.3210376501083374,
-0.7329692244529724,
-0.5375802516937256,
-0.5308499932289124,
0.10122117400169373,
1.460010290145874,
-1.3611506223678589,
-1.1798402070999146,
0.9276416301727295,
-0.8786376118659973,
-0.23239117860794067,
0.18732768297195435,
... |
javascript/reference/errors/missing_curly_after_function_body/index.md | JavaScript - Errors - Missing curly after function body - What went wrong?:
There is a syntax mistake when creating a function somewhere. Also check if any closing curly braces or parenthesis are in the correct order. Indenting or formatting the code a bit nicer might also help you to see through the jungle. | [
-1.298730731010437,
0.9736007452011108,
-0.596245527267456,
-0.6546931862831116,
-0.04342785105109215,
-1.1502395868301392,
-0.29736581444740295,
1.0769928693771362,
-1.4353065490722656,
-0.29640182852745056,
-0.042463432997465134,
-1.3831768035888672,
-0.4286367893218994,
0.17424111068248... |
javascript/reference/errors/missing_curly_after_function_body/index.md | JavaScript - Errors - Missing curly after function body - Examples - Forgotten closing curly bracket:
Oftentimes, there is a missing curly bracket in your function code:
Example:
function charge() {
if (sunny) {
useSolarCells();
} else {
promptBikeRide();
}
Correct would be:
Example:
function charge()... | [
-1.3153926134109497,
0.7842322587966919,
-0.8159035444259644,
-0.5583235025405884,
-0.18683989346027374,
-2.1343064308166504,
0.6335688233375549,
0.6306089162826538,
-1.6092071533203125,
-0.054748278111219406,
-0.07873678207397461,
-0.9587358832359314,
-0.16337843239307404,
0.0122379017993... |
javascript/reference/errors/unexpected_token/index.md | JavaScript - Errors - Unexpected token:
The JavaScript exceptions "unexpected token" occur when the parser does not see a token it recognizes at the given position, so it cannot make sense of the structure of the program. This might be a simple typo. | [
0.0824877992272377,
-0.001360212336294353,
-0.424988716840744,
-0.20712396502494812,
-0.0449797548353672,
-0.6833357810974121,
0.4657478630542755,
0.7347990870475769,
-0.6199353337287903,
-0.03218095004558563,
-0.2667331397533417,
-0.03236036375164986,
-0.6890642642974854,
0.03967760503292... |
javascript/reference/errors/unexpected_token/index.md | JavaScript - Errors - Unexpected token - Message:
Example:
SyntaxError: Unexpected token ';' (V8-based)
SyntaxError: Unexpected identifier 'x' (V8-based)
SyntaxError: Unexpected number (V8-based)
SyntaxError: Unexpected string (V8-based)
SyntaxError: Unexpected regular expression (V8-based)
SyntaxError: Unexpected te... | [
0.16130538284778595,
0.4290752708911896,
-1.3330227136611938,
-0.04937800392508507,
-0.4220949411392212,
-1.5166057348251343,
0.6985953450202942,
1.4561750888824463,
-0.16930311918258667,
-0.4939238727092743,
-0.07531461119651794,
0.22556719183921814,
-0.2747049629688263,
-0.00190438225399... |
javascript/reference/errors/unexpected_token/index.md | JavaScript - Errors - Unexpected token - Error type:
`SyntaxError` | [
-0.16166268289089203,
0.20516005158424377,
-0.5069519281387329,
-0.30412063002586365,
-0.6051386594772339,
-0.4765561521053314,
0.8620598316192627,
2.3001930713653564,
-0.21916842460632324,
-1.0245202779769897,
0.4574602246284485,
0.5467201471328735,
-0.5132479071617126,
-0.159067377448081... |
javascript/reference/errors/unexpected_token/index.md | JavaScript - Errors - Unexpected token - What went wrong?:
A specific language construct was expected, but something else was provided. This might be a simple typo. | [
0.05200778320431709,
-0.054852504283189774,
-0.7924157381057739,
-0.35046717524528503,
0.006157605443149805,
-1.3680721521377563,
-0.16996294260025024,
1.510306715965271,
-1.0835058689117432,
-0.35810863971710205,
0.1105392798781395,
0.025382550433278084,
-0.834979236125946,
-0.05765858665... |
javascript/reference/errors/unexpected_token/index.md | JavaScript - Errors - Unexpected token - Examples - Expression expected:
For example, when chaining expressions, trailing commas are not allowed.
Example:
for (let i = 0; i < 5,; ++i) {
console.log(i);
}
// Uncaught SyntaxError: expected expression, got ';'
Correct would be omitting the comma or adding another ex... | [
0.03901505097746849,
-0.061307936906814575,
-1.2353514432907104,
0.5364553332328796,
0.042106058448553085,
-1.2151494026184082,
-0.0036872841883450747,
1.8087410926818848,
-1.7309192419052124,
-0.2392733097076416,
-0.1771874874830246,
-0.36843469738960266,
-0.4971555471420288,
-0.128067463... |
javascript/reference/errors/unexpected_token/index.md | JavaScript - Errors - Unexpected token - Examples - Not enough parentheses:
Sometimes, you leave out parentheses around `if` statements:
Example:
function round(n, upperBound, lowerBound) {
if (n > upperBound) || (n < lowerBound) { // Missing parentheses here!
throw new Error(`Number ${n} is more than ${upperBou... | [
0.3855973482131958,
0.9369795918464661,
-0.49930882453918457,
0.2486870437860489,
0.47671711444854736,
-0.054694294929504395,
0.009125396609306335,
0.865074872970581,
-0.2935084402561188,
-0.28346800804138184,
-0.49016764760017395,
-0.1357714980840683,
-0.7925690412521362,
0.47036391496658... |
javascript/reference/errors/unexpected_token/index.md | JavaScript - Errors - Unexpected token - Examples - A structure error further up confused the meaning:
Sometimes, the error is caused by some structure issues not directly next to the error location, so you need to look around for potential errors. For example, you intended to declare a method of an object, but you de... | [
0.29634082317352295,
-0.14857439696788788,
-0.45109617710113525,
0.32293805480003357,
0.16476106643676758,
-1.295091152191162,
0.21176046133041382,
0.8691612482070923,
-0.6068663597106934,
-0.6615840792655945,
0.19430501759052277,
0.003313535824418068,
-0.7528077960014343,
-0.0156918670982... |
javascript/reference/errors/regex_invalid_class_set_operation/index.md | JavaScript - Errors - Regex invalid class set operation:
The JavaScript exception "invalid class set operation in regular expression" occurs when a double punctuator sequence appears in a `v`-mode character class but it is not recognized by the syntax. | [
-0.8487376570701599,
-0.6326753497123718,
-1.2701475620269775,
1.1045787334442139,
0.26484864950180054,
0.10816241800785065,
-0.4632098972797394,
1.5998566150665283,
-0.3221963047981262,
-0.3943764865398407,
-0.8589125275611877,
-1.4288262128829956,
0.33576908707618713,
-0.9180634617805481... |
javascript/reference/errors/regex_invalid_class_set_operation/index.md | JavaScript - Errors - Regex invalid class set operation - Message:
Example:
SyntaxError: Invalid regular expression: /[&&]/v: Invalid set operation in character class (V8-based)
SyntaxError: invalid class set operation in regular expression (Firefox)
SyntaxError: Invalid regular expression: invalid operation in class... | [
-0.7336809039115906,
0.3232343792915344,
-1.0820753574371338,
0.19984395802021027,
0.12502199411392212,
-0.6761888265609741,
0.023202965036034584,
1.3753736019134521,
-0.2720927894115448,
-0.32451093196868896,
-0.10248414427042007,
-1.2338179349899292,
0.49491938948631287,
-1.1085196733474... |
javascript/reference/errors/regex_invalid_class_set_operation/index.md | JavaScript - Errors - Regex invalid class set operation - Error type:
`SyntaxError` | [
-0.20220071077346802,
0.3342013657093048,
-0.5495301485061646,
-0.033064208924770355,
-0.5990355610847473,
-0.20728757977485657,
0.5425846576690674,
2.06561541557312,
-0.15243905782699585,
-0.9698818922042847,
0.07851196080446243,
-0.9056863784790039,
0.27717602252960205,
-0.51444923877716... |
javascript/reference/errors/regex_invalid_class_set_operation/index.md | JavaScript - Errors - Regex invalid class set operation - What went wrong?:
There are three possible ways this could happen:
- You are trying to use `&&` or `--`, but the syntax is wrong. Each of these operators must join two characters or character sets.
- You are mixing operators on the same level. For example, `[\... | [
0.17104248702526093,
0.4955710172653198,
-0.504021167755127,
0.37743693590164185,
0.6926902532577515,
0.4149245321750641,
0.08088880777359009,
0.9812662601470947,
0.08427834510803223,
-0.06746387481689453,
-0.04258723929524422,
-0.8558007478713989,
0.6500597596168518,
-0.3860473334789276,
... |
javascript/reference/errors/json_bad_parse/index.md | JavaScript - Errors - JSON bad parse:
The JavaScript exceptions thrown by `JSON.parse()` occur when string failed to be parsed as JSON. | [
0.3335578143596649,
0.7378837466239929,
-0.8385738134384155,
-0.5853261947631836,
-0.21194611489772797,
-0.6062393188476562,
0.9148668050765991,
1.1476502418518066,
-1.1964973211288452,
0.413234144449234,
-0.6834850311279297,
-0.4275510311126709,
-0.7276490926742554,
0.24780665338039398,
... |
javascript/reference/errors/json_bad_parse/index.md | JavaScript - Errors - JSON bad parse - Message:
Example:
SyntaxError: JSON.parse: unterminated string literal
SyntaxError: JSON.parse: bad control character in string literal
SyntaxError: JSON.parse: bad character in string literal
SyntaxError: JSON.parse: bad Unicode escape
SyntaxError: JSON.parse: bad escape charac... | [
-0.03389656916260719,
0.1463666409254074,
-0.5971847772598267,
-0.1095510721206665,
0.5594837069511414,
-0.6064803600311279,
0.5733925700187683,
0.8116945624351501,
-0.1265343576669693,
-0.3128625154495239,
-0.16480331122875214,
0.312095046043396,
-0.7475799918174744,
0.045145340263843536,... |
javascript/reference/errors/json_bad_parse/index.md | JavaScript - Errors - JSON bad parse - Error type:
`SyntaxError` | [
0.004561814945191145,
0.22269552946090698,
-0.9810576438903809,
-0.8475427031517029,
-0.1833934187889099,
-0.4656274914741516,
1.2888891696929932,
1.9270620346069336,
-0.7251601815223694,
-0.38924074172973633,
0.1331367790699005,
-0.2579808235168457,
-0.4402370750904083,
-0.044865112751722... |
javascript/reference/errors/json_bad_parse/index.md | JavaScript - Errors - JSON bad parse - What went wrong?:
`JSON.parse()` parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered. | [
0.15687295794487,
1.0209301710128784,
-1.0365114212036133,
-0.5844428539276123,
0.11553910374641418,
-0.8759909272193909,
0.46316131949424744,
1.0489320755004883,
-0.7346930503845215,
0.6239550709724426,
-0.3561371862888336,
-0.5083581805229187,
-0.48557308316230774,
0.025759542360901833,
... |
javascript/reference/errors/json_bad_parse/index.md | JavaScript - Errors - JSON bad parse - Examples - JSON.parse() does not allow trailing commas:
Both lines will throw a SyntaxError:
Example:
JSON.parse("[1, 2, 3, 4,]");
JSON.parse('{"foo": 1,}');
// SyntaxError JSON.parse: unexpected character
// at line 1 column 14 of the JSON data
Omit the trailing commas to par... | [
-0.0770585909485817,
0.5912551283836365,
-1.4172471761703491,
-0.5725576281547546,
0.49831193685531616,
-1.165177345275879,
0.647013247013092,
1.2690366506576538,
-1.9952781200408936,
0.3330794870853424,
-0.40679052472114563,
0.16417042911052704,
0.38269853591918945,
-0.8788766860961914,
... |
javascript/reference/errors/json_bad_parse/index.md | JavaScript - Errors - JSON bad parse - Examples - Property names must be double-quoted strings:
You cannot use single-quotes around properties, like 'foo'.
Example:
JSON.parse("{'foo': 1}");
// SyntaxError: JSON.parse: expected property name or '}'
// at line 1 column 2 of the JSON data
Instead write "foo":
Exampl... | [
-0.8660809993743896,
0.41978344321250916,
-0.926376461982727,
0.3150898218154907,
0.15669332444667816,
-1.346713662147522,
1.1830660104751587,
1.0675551891326904,
-1.3830196857452393,
0.1516340970993042,
-0.34149789810180664,
0.30476170778274536,
-0.24130083620548248,
-1.2292191982269287,
... |
javascript/reference/errors/json_bad_parse/index.md | JavaScript - Errors - JSON bad parse - Examples - Leading zeros and decimal points:
You cannot use leading zeros, like 01, and decimal points must be followed by at least one digit.
Example:
JSON.parse('{"foo": 01}');
// SyntaxError: JSON.parse: expected ',' or '}' after property value
// in object at line 1 column ... | [
0.21978867053985596,
0.04475274309515953,
-1.3467196226119995,
-0.479889839887619,
0.3528410494327545,
-1.1060757637023926,
1.1173136234283447,
0.6100149750709534,
-1.85317862033844,
0.2530059218406677,
-0.616271436214447,
-0.11652564257383347,
-0.21647733449935913,
-0.5753636956214905,
... |
javascript/reference/errors/negative_repetition_count/index.md | JavaScript - Errors - Negative repetition count:
The JavaScript exception "repeat count must be non-negative" occurs when the `String.prototype.repeat()` method is used with a `count` argument that is a negative number. | [
-1.016472339630127,
-0.33058685064315796,
-0.5094149112701416,
0.2023029625415802,
-0.07601281255483627,
-1.4016920328140259,
0.5853033065795898,
1.046228289604187,
-1.4808623790740967,
-0.06358499825000763,
-1.562613844871521,
-0.7525023818016052,
-0.2708260416984558,
-0.3134348392486572,... |
javascript/reference/errors/negative_repetition_count/index.md | JavaScript - Errors - Negative repetition count - Message:
Example:
RangeError: Invalid count value: -1 (V8-based)
RangeError: repeat count must be non-negative (Firefox)
RangeError: String.prototype.repeat argument must be greater than or equal to 0 and not be Infinity (Safari) | [
-1.5853008031845093,
-0.0693601444363594,
-0.9071763157844543,
-0.18173758685588837,
-0.18437182903289795,
-1.328477382659912,
0.9463055729866028,
0.6601458191871643,
-1.4134833812713623,
-0.2086811661720276,
-0.7409509420394897,
-0.6518980860710144,
-0.5511146187782288,
-0.229385167360305... |
javascript/reference/errors/negative_repetition_count/index.md | JavaScript - Errors - Negative repetition count - Error type:
`RangeError` | [
-0.9204835891723633,
-0.033057600259780884,
-1.077195644378662,
-0.5550077557563782,
-0.40141183137893677,
-0.17206816375255585,
1.4593738317489624,
2.4761605262756348,
-0.9183222055435181,
-0.535325825214386,
-0.8953644633293152,
-0.46756044030189514,
-0.9368669390678406,
0.08129230886697... |
javascript/reference/errors/negative_repetition_count/index.md | JavaScript - Errors - Negative repetition count - What went wrong?:
The `String.prototype.repeat()` method has been used. It has a `count` parameter indicating the number of times to repeat the string. It must be between 0 and less than positive `Infinity` and cannot be a negative number. The range of allowed values c... | [
-1.1923105716705322,
-0.17639368772506714,
-0.6389912366867065,
0.09708551317453384,
0.10162937641143799,
-1.510689616203308,
0.7068530321121216,
0.7906948328018188,
-1.1385467052459717,
-0.11663305014371872,
-1.3785252571105957,
0.002736578928306699,
0.04527295380830765,
-0.60950553417205... |
javascript/reference/errors/negative_repetition_count/index.md | JavaScript - Errors - Negative repetition count - Examples - Invalid cases:
Example:
"abc".repeat(-1); // RangeError | [
-0.5927050113677979,
0.41745126247406006,
-1.1012645959854126,
0.06568623334169388,
-0.16804908215999603,
-0.4732290208339691,
1.4035810232162476,
1.706173062324524,
-1.5700525045394897,
-0.1455887407064438,
-1.052734613418579,
-0.4982072114944458,
-0.9964606761932373,
0.16606944799423218,... |
javascript/reference/errors/negative_repetition_count/index.md | JavaScript - Errors - Negative repetition count - Examples - Valid cases:
Example:
"abc".repeat(0); // ''
"abc".repeat(1); // 'abc'
"abc".repeat(2); // 'abcabc'
"abc".repeat(3.5); // 'abcabcabc' (count will be converted to integer) | [
-0.5130953788757324,
0.6289042830467224,
-0.8613783121109009,
0.3011818826198578,
-0.1912689059972763,
-0.7252553701400757,
1.1358134746551514,
1.1319661140441895,
-0.8615768551826477,
0.4801979660987854,
-1.2307798862457275,
-0.3773458003997803,
-0.14631368219852448,
0.3184831440448761,
... |
javascript/reference/errors/not_a_function/index.md | JavaScript - Errors - Not a function:
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value is not actually a function. | [
0.45634475350379944,
0.11783641576766968,
-1.3638657331466675,
0.3074289560317993,
-0.5756464600563049,
-1.1218883991241455,
0.41037097573280334,
1.4888170957565308,
-0.8698350787162781,
-0.18248480558395386,
-0.0857156291604042,
-1.045680046081543,
-0.37164050340652466,
-0.074990034103393... |
javascript/reference/errors/not_a_function/index.md | JavaScript - Errors - Not a function - Message:
Example:
TypeError: "x" is not a function. (V8-based & Firefox & Safari) | [
0.23891417682170868,
0.27909550070762634,
-1.9540257453918457,
-0.5585423111915588,
-1.1861534118652344,
-0.21681039035320282,
0.5354496836662292,
1.8219610452651978,
-0.3357933759689331,
-0.5526819229125977,
0.8384114503860474,
-0.7883030772209167,
-0.044297199696302414,
-0.73263227939605... |
javascript/reference/errors/not_a_function/index.md | JavaScript - Errors - Not a function - Error type:
`TypeError` | [
0.25008994340896606,
0.2713637948036194,
-1.3911939859390259,
-0.7889280915260315,
-0.5705118179321289,
0.3213229179382324,
0.7787393927574158,
2.1901535987854004,
-0.6087684631347656,
-0.8925187587738037,
0.3693253695964813,
-0.6671276688575745,
0.12891894578933716,
-0.2973640263080597,
... |
javascript/reference/errors/not_a_function/index.md | JavaScript - Errors - Not a function - What went wrong?:
It attempted to call a value from a function, but the value is not actually a function. Some code expects you to provide a function, but that didn't happen.
Maybe there is a typo in the function name? Maybe the object you are calling the method on does not have... | [
-0.10793019086122513,
0.06188804283738136,
-0.7492280602455139,
0.08753553777933121,
0.5674987435340881,
-1.0318095684051514,
0.4732458293437958,
0.9712740182876587,
-0.38319700956344604,
-0.2098187655210495,
0.1629067063331604,
0.11845948547124863,
0.4370613396167755,
0.5543134808540344,
... |
javascript/reference/errors/not_a_function/index.md | JavaScript - Errors - Not a function - Examples - A typo in the function name:
In this case, which happens way too often, there is a typo in the method name:
Example:
const x = document.getElementByID("foo");
// TypeError: document.getElementByID is not a function
The correct function name is `getElementById`:
Exa... | [
0.26249366998672485,
-0.29136571288108826,
-1.2752336263656616,
-0.506060004234314,
-0.3149639964103699,
-1.7383294105529785,
-0.3157111406326294,
0.8024706244468689,
-1.4061790704727173,
-0.5525896549224854,
0.1344650834798813,
-1.240763783454895,
-0.5657684803009033,
-0.8439835906028748,... |
javascript/reference/errors/not_a_function/index.md | JavaScript - Errors - Not a function - Examples - Function called on the wrong object:
For certain methods, you have to provide a (callback) function and it will work on specific objects only. In this example, `Array.prototype.map()` is used, which will work with `Array` objects only.
Example:
const obj = { a: 13, b... | [
-0.23892049491405487,
0.08092256635427475,
-1.565036416053772,
0.14513182640075684,
-0.12584590911865234,
-0.8698207139968872,
0.2572769224643707,
0.7681107521057129,
-1.1269571781158447,
0.20332320034503937,
-0.4449772238731384,
-0.24979478120803833,
0.6126210689544678,
-0.355923265218734... |
javascript/reference/errors/not_a_function/index.md | JavaScript - Errors - Not a function - Examples - Function shares a name with a pre-existing property:
Sometimes when making a class, you may have a property and a function with the same name. Upon calling the function, the compiler thinks that the function ceases to exist.
Example:
function Dog() {
this.age = 11;... | [
-0.9818031787872314,
-0.8519576787948608,
-1.6860793828964233,
0.3984258770942688,
-0.2379237711429596,
-1.2420942783355713,
0.31413534283638,
1.7517597675323486,
-0.19212037324905396,
-0.1938955932855606,
-0.41104257106781006,
-0.04036664590239525,
-0.10805097967386246,
-0.372664064168930... |
javascript/reference/errors/not_a_function/index.md | JavaScript - Errors - Not a function - Examples - Using parentheses for multiplication:
In math, you can write 2 × (3 + 5) as 2(3 + 5) or just 2(3 + 5).
Using the latter will throw an error:
Example:
const sixteen = 2(3 + 5);
console.log(`2 x (3 + 5) is ${sixteen}`);
// Uncaught TypeError: 2 is not a function
You ... | [
0.568189799785614,
0.05787529796361923,
-1.0685477256774902,
0.3199237883090973,
-0.37216272950172424,
-0.5738548040390015,
0.9339727759361267,
1.717499852180481,
0.2407255619764328,
-0.5475934743881226,
-0.8543444871902466,
0.6559154391288757,
-0.5647489428520203,
-0.5843562483787537,
-... |
javascript/reference/errors/not_a_function/index.md | JavaScript - Errors - Not a function - Examples - Import the exported module correctly:
Ensure you are importing the module correctly.
An example helpers library (`helpers.js`)
Example:
function helpers() {}
helpers.groupBy = function (objectArray, property) {
return objectArray.reduce((acc, obj) => {
const ... | [
0.6256401538848877,
0.19715069234371185,
-2.0749521255493164,
0.8424503207206726,
-0.1599738597869873,
-1.4576606750488281,
0.003892838954925537,
0.1445378065109253,
-1.440826654434204,
0.5895166993141174,
-0.49525943398475647,
0.4334639608860016,
-0.286323219537735,
-0.09700742363929749,
... |
javascript/reference/errors/invalid_date/index.md | JavaScript - Errors - Invalid date:
The JavaScript exception "invalid date" occurs when an invalid date is attempted to be converted to an ISO date string. | [
0.08695199340581894,
0.12223630398511887,
-0.6445859670639038,
0.5446454882621765,
0.04649309441447258,
-1.4246240854263306,
0.5942401885986328,
1.1186765432357788,
-1.3918089866638184,
0.16470810770988464,
-0.6015449166297913,
-1.0480340719223022,
0.2830262780189514,
-0.48542699217796326,... |
javascript/reference/errors/invalid_date/index.md | JavaScript - Errors - Invalid date - Message:
Example:
RangeError: Invalid time value (V8-based)
RangeError: invalid date (Firefox)
RangeError: Invalid Date (Safari) | [
-0.6421476006507874,
0.09668462723493576,
-1.1609207391738892,
-0.12197326123714447,
-0.39684030413627625,
-1.157883644104004,
0.8418954014778137,
1.1234691143035889,
-1.2436844110488892,
-0.2469629943370819,
0.3353102207183838,
-0.3139824867248535,
0.030398176982998848,
-0.884203851222991... |
javascript/reference/errors/invalid_date/index.md | JavaScript - Errors - Invalid date - Error type:
`RangeError` | [
-0.3482038080692291,
0.20914475619792938,
-1.352771520614624,
-0.2377598136663437,
-0.6138052344322205,
-0.6645609736442566,
0.8632898926734924,
2.1729354858398438,
-1.326690912246704,
-0.8146307468414307,
0.22958102822303772,
0.026742884889245033,
-0.286488801240921,
-0.46715211868286133,... |
javascript/reference/errors/invalid_date/index.md | JavaScript - Errors - Invalid date - What went wrong?:
You are converting an invalid date value to an ISO date string. This usually happens in one of three ways:
- Calling the `toISOString()` method
- Calling the `toJSON()` method, which implicitly calls `toISOString`
- Using `JSON.stringify()` to stringify the date,... | [
-0.6458414196968079,
0.23553673923015594,
-0.4016127288341522,
0.29520925879478455,
0.4089086353778839,
-1.2791903018951416,
0.2034873217344284,
0.7615079283714294,
-1.4156501293182373,
1.041824460029602,
-0.20509853959083557,
-0.26788803935050964,
-0.05589008703827858,
-0.2286273241043090... |
javascript/reference/errors/invalid_date/index.md | JavaScript - Errors - Invalid date - Examples - Invalid cases:
Example:
const invalid = new Date("nothing");
invalid.toISOString(); // RangeError: invalid date
invalid.toJSON(); // RangeError: invalid date
JSON.stringify({ date: invalid }); // RangeError: invalid date
However, most other methods return special value... | [
-0.4325152337551117,
0.18091470003128052,
-0.29177555441856384,
0.26247966289520264,
0.5582676529884338,
-1.5288790464401245,
0.765549898147583,
1.282364010810852,
-0.9868342280387878,
0.4973195195198059,
-0.3721671998500824,
-0.03928567096590996,
0.11313177645206451,
-0.07344548404216766,... |
javascript/reference/errors/invalid_date/index.md | JavaScript - Errors - Invalid date - Examples - Valid cases:
Example:
new Date("05 October 2011 14:48 UTC").toISOString(); // "2011-10-05T14:48:00.000Z"
new Date(1317826080).toISOString(); // "2011-10-05T14:48:00.000Z" | [
0.28307950496673584,
0.34826037287712097,
-0.663016140460968,
0.9424938559532166,
0.1454637199640274,
-1.0136358737945557,
0.0005338388727977872,
1.1240875720977783,
-1.129572868347168,
-0.020592566579580307,
-0.04966910183429718,
-0.27322402596473694,
-0.052303120493888855,
-0.07478383183... |
javascript/reference/errors/hash_outside_class/index.md | JavaScript - Errors - Hash outside class:
The JavaScript exception "Unexpected '#' used outside of class body" occurs when a hash ("#") is encountered in an unexpected context, most notably outside of a class declaration. Hashes are valid at the beginning of a file as a hashbang comment, or inside of a class as part o... | [
-0.03523792698979378,
-0.5376013517379761,
-1.0793224573135376,
1.009547233581543,
-0.4813002645969391,
-1.5589179992675781,
0.36397600173950195,
0.6394749879837036,
-0.8991134166717529,
-0.31959059834480286,
-1.158446192741394,
-0.030276019126176834,
-0.5068120956420898,
-0.39747104048728... |
javascript/reference/errors/hash_outside_class/index.md | JavaScript - Errors - Hash outside class - Message:
Example:
SyntaxError: Unexpected '#' used outside of class body. | [
-0.05171008035540581,
-0.02518203668296337,
-0.9786942601203918,
0.10917799174785614,
-0.833565890789032,
-2.053586483001709,
-0.08994422107934952,
1.8138352632522583,
-0.9181774258613586,
-0.7700717449188232,
-0.9378653764724731,
0.10269153118133545,
-0.6421664357185364,
-0.22874084115028... |
javascript/reference/errors/hash_outside_class/index.md | JavaScript - Errors - Hash outside class - Error type:
`SyntaxError` | [
0.1926099807024002,
-0.1640782356262207,
-0.6818365454673767,
-0.11309344321489334,
-0.8690723180770874,
-0.8079220652580261,
0.557767391204834,
2.4299285411834717,
-0.5893624424934387,
-1.2412638664245605,
-0.37152114510536194,
0.06415167450904846,
-0.5933786630630493,
-0.2229784429073333... |
javascript/reference/errors/hash_outside_class/index.md | JavaScript - Errors - Hash outside class - What went wrong?:
We encountered a `#` somewhere unexpected. This may be due to code moving around and no longer being part of a class, a hashbang comment found on a line other than the first line of a file, or accidentally forgetting the quotation marks around a DOM identifi... | [
-0.16133953630924225,
-0.4704163670539856,
-1.0874676704406738,
-0.15467894077301025,
-0.34597325325012207,
-1.717033863067627,
-0.2416345775127411,
1.610408902168274,
-0.016305161640048027,
0.06597106158733368,
-1.0016120672225952,
-0.5007086992263794,
-0.6968093514442444,
-0.111849203705... |
javascript/reference/errors/hash_outside_class/index.md | JavaScript - Errors - Hash outside class - Examples - Missing quotation marks:
For each case, there might be something slightly wrong. For example
Example:
document.querySelector(#some-element)
This can be fixed via
Example:
document.querySelector("#some-element"); | [
-0.4086546301841736,
-0.7313227653503418,
-0.4052257537841797,
0.22782254219055176,
-0.27731090784072876,
-0.788574755191803,
0.8944059610366821,
1.3762483596801758,
-1.9341899156570435,
-0.3486769497394562,
-0.2273406833410263,
-0.2942776679992676,
-0.7210882306098938,
-0.3685742020606994... |
javascript/reference/errors/hash_outside_class/index.md | JavaScript - Errors - Hash outside class - Examples - Outside of a class:
Example:
class ClassWithPrivateField {
#privateField;
constructor() {}
}
this.#privateField = 42;
This can be fixed by moving the private field back into the class
Example:
class ClassWithPrivateField {
#privateField;
constructor(... | [
-0.5192131996154785,
-0.5423610806465149,
-0.6976258754730225,
0.29000455141067505,
-0.35197314620018005,
-1.1626827716827393,
0.269120991230011,
0.962581992149353,
-0.5284270644187927,
-0.7092241644859314,
-1.3513864278793335,
0.12057013809680939,
-0.6273033022880554,
-0.6638903021812439,... |
javascript/reference/errors/cant_define_property_object_not_extensible/index.md | JavaScript - Errors - Cant define property object not extensible:
The JavaScript exception "can't define property "x": "obj" is not extensible" occurs when an object is marked as non-extensible, so that it will never have properties beyond the ones it had at the time it was marked as non-extensible. Objects can be mad... | [
-1.211187481880188,
0.2394067347049713,
-0.5163657069206238,
0.6577065587043762,
-0.35064539313316345,
-1.9873722791671753,
0.8087930083274841,
0.8357518315315247,
-0.061104342341423035,
-0.015757564455270767,
-0.2847004234790802,
-0.1142573282122612,
-0.32106974720954895,
-0.7614565491676... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.