file stringlengths 16 94 | text stringlengths 32 24.4k | vector list |
|---|---|---|
javascript/reference/errors/called_on_incompatible_type/index.md | JavaScript - Errors - Called on incompatible type - Examples - Invalid cases:
Example:
const mySet = new Set();
["bar", "baz"].forEach(mySet.add);
// mySet.add is a function, but "mySet" is not captured as this.
function myFun() {
console.log(this);
}
["bar", "baz"].forEach(myFun.bind);
// myFun.bind is a function... | [
0.07627099007368088,
-0.09104325622320175,
-1.8402760028839111,
0.5095824003219604,
-0.16840285062789917,
-0.9509660601615906,
0.16330662369728088,
0.9644509553909302,
-0.6304672360420227,
0.32431963086128235,
-0.569667398929596,
-0.31929275393486023,
-0.16423670947551727,
-0.2185278087854... |
javascript/reference/errors/called_on_incompatible_type/index.md | JavaScript - Errors - Called on incompatible type - Examples - Valid cases:
Example:
const mySet = new Set();
["bar", "baz"].forEach(mySet.add.bind(mySet));
// This works due to binding "mySet" as this.
function myFun() {
console.log(this);
}
["bar", "baz"].forEach((x) => myFun.bind(x));
// This works using the "b... | [
-0.019970037043094635,
-0.05993211641907692,
-1.3097175359725952,
0.6554911136627197,
0.021601557731628418,
-1.0333857536315918,
0.6996133327484131,
0.5954307913780212,
-0.14632254838943481,
0.30257365107536316,
-0.8557583689689636,
0.0497550405561924,
-0.3085085451602936,
0.19782020151615... |
javascript/reference/errors/no_non-null_object/index.md | JavaScript - Errors - No non-null object:
The JavaScript exception "is not a non-null object" occurs when an object is expected somewhere and wasn't provided. `null` is not an object and won't work. | [
-0.1845492124557495,
0.1388835906982422,
-0.8834891319274902,
0.47044429183006287,
-0.5205044746398926,
-1.467023491859436,
0.6123447418212891,
1.1548042297363281,
-0.8210713863372803,
0.02933068387210369,
-0.19923220574855804,
-1.4141833782196045,
-0.3030765652656555,
-0.2262546718120575,... |
javascript/reference/errors/no_non-null_object/index.md | JavaScript - Errors - No non-null object - Message:
Example:
TypeError: Property description must be an object: x (V8-based)
TypeError: Property descriptor must be an object, got "x" (Firefox)
TypeError: Property description must be an object. (Safari) | [
-1.1551727056503296,
-0.5036302208900452,
-1.4202325344085693,
0.10554073005914688,
-0.603441059589386,
-0.8909370303153992,
0.5642030835151672,
0.8375749588012695,
-0.28058168292045593,
-0.5323013067245483,
-0.10368631035089493,
-1.0915157794952393,
0.26550960540771484,
-1.063924670219421... |
javascript/reference/errors/no_non-null_object/index.md | JavaScript - Errors - No non-null object - Error type:
`TypeError` | [
-0.48211854696273804,
-0.034999046474695206,
-0.8878372311592102,
-0.1384173333644867,
-0.6791179776191711,
0.22530712187290192,
1.1978203058242798,
2.226638078689575,
-0.5093065500259399,
-0.7879413366317749,
0.37946388125419617,
-1.6330422163009644,
0.061545439064502716,
-0.5284520983695... |
javascript/reference/errors/no_non-null_object/index.md | JavaScript - Errors - No non-null object - What went wrong?:
An object is expected somewhere and wasn't provided. `null` is not an object and won't work. You must provide a proper object in the given situation. | [
-0.270912766456604,
0.4310346245765686,
-1.332662582397461,
-0.2047451138496399,
-0.3144725561141968,
-1.1514512300491333,
0.2667752206325531,
1.2523198127746582,
-0.7024518251419067,
0.21877025067806244,
0.0919206365942955,
-1.1257845163345337,
-0.392539381980896,
-0.07719724625349045,
... |
javascript/reference/errors/no_non-null_object/index.md | JavaScript - Errors - No non-null object - Examples - Property descriptor expected:
When methods like `Object.create()` or `Object.defineProperty()` and `Object.defineProperties()` are used, the optional descriptor parameter expects a property descriptor object. Providing no object (like just a number), will throw an ... | [
-1.1705361604690552,
-0.13353298604488373,
-1.157199740409851,
0.38037440180778503,
-0.16865816712379456,
-0.5014962553977966,
0.6308772563934326,
0.9400732517242432,
0.07306753844022751,
-0.18548500537872314,
-0.4514105021953583,
-0.8545621037483215,
0.22161425650119781,
-0.58825743198394... |
javascript/reference/errors/missing_curly_after_property_list/index.md | JavaScript - Errors - Missing curly after property list:
The JavaScript exception "missing } after property list" occurs when there is a mistake in the object initializer syntax somewhere. Might be in fact a missing curly bracket, but could also be a missing comma. | [
-1.5457342863082886,
0.07279743999242783,
-0.6360874772071838,
0.44813382625579834,
0.45432865619659424,
-1.081181526184082,
0.2826346457004547,
0.6911477446556091,
-1.4477076530456543,
-0.062458399683237076,
-0.1613692045211792,
-0.8457674980163574,
-0.40650638937950134,
-0.20103397965431... |
javascript/reference/errors/missing_curly_after_property_list/index.md | JavaScript - Errors - Missing curly after property list - Message:
Example:
SyntaxError: missing } after property list (Firefox)
SyntaxError: Unexpected identifier 'c'. Expected '}' to end an object literal. (Safari) | [
-2.1301753520965576,
0.4010981023311615,
-0.8841896653175354,
-0.24938106536865234,
-0.1453833132982254,
-1.6009148359298706,
0.5099325776100159,
0.8986625075340271,
-0.32682564854621887,
-0.27912217378616333,
1.0238542556762695,
-0.14507558941841125,
-0.1695709079504013,
-0.48728916049003... |
javascript/reference/errors/missing_curly_after_property_list/index.md | JavaScript - Errors - Missing curly after property list - Error type:
`SyntaxError` | [
-2.0333101749420166,
0.4431254267692566,
-0.38551396131515503,
-0.5007913708686829,
-0.3826197385787964,
-0.7310879826545715,
0.5864238739013672,
1.465667486190796,
-1.0607211589813232,
-0.8699449896812439,
0.9032106995582581,
-0.2068527191877365,
-0.19479995965957642,
-0.17952705919742584... |
javascript/reference/errors/missing_curly_after_property_list/index.md | JavaScript - Errors - Missing curly after property list - What went wrong?:
There is a mistake in the object initializer syntax somewhere. Might be in fact a missing curly bracket, but could also be a missing comma, for example. Also check if any closing curly braces or parenthesis are in the correct order. Indenting ... | [
-1.501684546470642,
0.5444508790969849,
-0.6944054961204529,
-0.6470484733581543,
-0.15434902906417847,
-1.3766403198242188,
0.013474974781274796,
0.9901991486549377,
-1.6241474151611328,
0.04395656660199165,
-0.19373749196529388,
-1.1538081169128418,
-0.22647829353809357,
-0.3472103476524... |
javascript/reference/errors/missing_curly_after_property_list/index.md | JavaScript - Errors - Missing curly after property list - Examples - Forgotten comma:
Oftentimes, there is a missing comma in your object initializer code:
Example:
const obj = {
a: 1,
b: { myProp: 2 }
c: 3
};
Correct would be:
Example:
const obj = {
a: 1,
b: { myProp: 2 },
c: 3,
}; | [
-1.172106385231018,
0.23330214619636536,
-0.6374537944793701,
-0.31253916025161743,
0.38513126969337463,
-0.91778963804245,
-0.4115428328514099,
0.9170417189598083,
-1.6074023246765137,
0.3060073256492615,
-0.4356238543987274,
-0.5973324179649353,
-0.20087257027626038,
-0.44909873604774475... |
javascript/reference/errors/invalid_derived_return/index.md | JavaScript - Errors - Invalid derived return:
The JavaScript exception "derived class constructor returned invalid value x" occurs when a derived class constructor returns a value that is not an object or `undefined`. | [
-0.05525897815823555,
-0.34463608264923096,
-0.7467283010482788,
0.36584076285362244,
-0.8375422954559326,
-1.1802821159362793,
0.9046195149421692,
0.58505779504776,
-0.8224440813064575,
-0.2112712264060974,
-0.3686290979385376,
-0.8609254956245422,
-0.5768393278121948,
-0.4134563505649566... |
javascript/reference/errors/invalid_derived_return/index.md | JavaScript - Errors - Invalid derived return - Message:
Example:
TypeError: Derived constructors may only return object or undefined (V8-based)
TypeError: derived class constructor returned invalid value 1 (Firefox)
TypeError: Cannot return a non-object type in the constructor of a derived class. (Safari) | [
-0.6462185978889465,
-0.15284143388271332,
-0.8683544397354126,
-0.17451277375221252,
-0.5826536417007446,
-0.7701379060745239,
0.7813240885734558,
0.9440473914146423,
-1.040840983390808,
0.14039874076843262,
0.11816160380840302,
-0.45779287815093994,
-0.33646583557128906,
-0.8250499367713... |
javascript/reference/errors/invalid_derived_return/index.md | JavaScript - Errors - Invalid derived return - Error type:
`TypeError` | [
-0.12669211626052856,
-0.2831318974494934,
-0.8228309154510498,
-0.45271235704421997,
-0.6138271689414978,
0.421205073595047,
1.19321608543396,
1.9540644884109497,
-0.6301090121269226,
-0.6439847946166992,
0.10029249638319016,
-0.05436238646507263,
-0.483778715133667,
-0.30452388525009155,... |
javascript/reference/errors/invalid_derived_return/index.md | JavaScript - Errors - Invalid derived return - What went wrong?:
Typically, a constructor does not need to return anything—the value of `this` is automatically returned when the class is constructed. A constructor can also return an object, and this object will override `this` as the newly constructed instance. Howeve... | [
0.09347089380025864,
-0.03080974519252777,
-0.8748103976249695,
0.9281711578369141,
-0.07650497555732727,
-1.3246434926986694,
0.8381528258323669,
0.5257404446601868,
-0.5364072322845459,
-0.06657714396715164,
-0.5922830700874329,
-0.5012635588645935,
-0.4741748571395874,
0.014592250809073... |
javascript/reference/errors/invalid_derived_return/index.md | JavaScript - Errors - Invalid derived return - Examples - Invalid cases:
Example:
class Base {
constructor() {}
}
class Derived extends Base {
constructor() {
return 2;
}
}
new Derived(); // TypeError: derived class constructor returned invalid value 2 | [
0.4171634614467621,
0.02586202882230282,
-0.7994751334190369,
0.6612231731414795,
-0.35217517614364624,
-0.7873231172561646,
0.4914203882217407,
1.6479997634887695,
-0.9762191772460938,
-0.4919700026512146,
-0.4479166269302368,
-0.022988075390458107,
-0.38479188084602356,
-0.69693076610565... |
javascript/reference/errors/invalid_derived_return/index.md | JavaScript - Errors - Invalid derived return - Examples - Valid cases:
Example:
class Base {
constructor() {}
}
class Derived extends Base {
constructor() {
return { x: 1 };
}
}
new Derived(); // { x: 1 } | [
0.5114247798919678,
-0.052210647612810135,
-1.2124011516571045,
0.6334648132324219,
-0.3667217195034027,
-0.9050450325012207,
0.8232002258300781,
1.4671934843063354,
-0.847872257232666,
-0.7071772217750549,
-0.5617325305938721,
-0.33734771609306335,
-0.6199268698692322,
-0.5307049751281738... |
javascript/reference/errors/get_set_missing_private/index.md | JavaScript - Errors - Get set missing private:
The JavaScript exception "can't access private field or method: object is not the right class" or "can't set private field: object is not the right class" occurs when a private field or method is get or set on an object that does not have this private element defined. | [
-0.45619621872901917,
-0.09557754546403885,
-1.4470092058181763,
0.23115034401416779,
-0.24020232260227203,
-1.474689245223999,
0.7842099666595459,
0.6873759031295776,
-0.5022048950195312,
-0.4442265033721924,
-0.08034718781709671,
-0.6586601734161377,
-0.8097834587097168,
-0.7719427943229... |
javascript/reference/errors/get_set_missing_private/index.md | JavaScript - Errors - Get set missing private - Message:
Example:
TypeError: Cannot read private member #x from an object whose class did not declare it (V8-based)
TypeError: Cannot write private member #x to an object whose class did not declare it (V8-based)
TypeError: can't access private field or method: object i... | [
-1.108363389968872,
-0.21717175841331482,
-1.2638003826141357,
-0.1804693341255188,
-0.3083803951740265,
-0.794941782951355,
1.1540285348892212,
0.5401201248168945,
0.03575722500681877,
-0.19871635735034943,
0.43438953161239624,
-0.8491047024726868,
-0.5255028009414673,
-0.645679771900177,... |
javascript/reference/errors/get_set_missing_private/index.md | JavaScript - Errors - Get set missing private - Error type:
`TypeError` | [
-1.0935221910476685,
-0.12689271569252014,
-1.560373306274414,
-0.2887140214443207,
-0.4508192539215088,
0.20781365036964417,
1.5275737047195435,
1.472617745399475,
-0.5667016506195068,
-0.7810574769973755,
0.6993030309677124,
-0.5204218626022339,
-0.6162747740745544,
-0.37905752658843994,... |
javascript/reference/errors/get_set_missing_private/index.md | JavaScript - Errors - Get set missing private - What went wrong?:
You are trying to get or set a private field or method on an object, but that object does not contain this private element. Private instance properties can only be accessed on instances of the class (including its subclasses) that declares them; private... | [
-0.5068944692611694,
0.058275263756513596,
-1.01877760887146,
0.3427163064479828,
0.26104632019996643,
-1.0639498233795166,
1.4591494798660278,
0.6050887107849121,
-0.23969946801662445,
-0.4071853756904602,
0.02114972285926342,
-0.8141124844551086,
-0.5256593823432922,
-0.9728009104728699,... |
javascript/reference/errors/get_set_missing_private/index.md | JavaScript - Errors - Get set missing private - Examples - Mismatched static/instance fields:
You may have declared the field as a static field, but are trying to access it on an instance, or vice versa.
Example:
class MyClass {
static #x = 0;
doSomething() {
console.log(this.#x);
}
}
const obj = new MyCl... | [
-0.7966113686561584,
-0.6501803398132324,
-0.8226300477981567,
-0.14337407052516937,
0.2746008336544037,
-1.2752540111541748,
0.6878966689109802,
0.6912001967430115,
0.5007511973381042,
0.34163105487823486,
-0.02350836992263794,
-0.48758959770202637,
-0.48834753036499023,
-0.87686145305633... |
javascript/reference/errors/get_set_missing_private/index.md | JavaScript - Errors - Get set missing private - Examples - Wrong object used:
Perhaps you have a method that access `this.#x`, but it is called with another `this` value.
Example:
class JSONReplacer {
#count = 0;
func(key, value) {
if (typeof value === "object") {
this.#count++;
}
return value;... | [
0.09014569222927094,
0.06573346257209778,
-1.024776816368103,
0.22099098563194275,
0.7817400693893433,
-0.5699211359024048,
0.5987327098846436,
0.9867486953735352,
-0.27247947454452515,
0.022098150104284286,
0.03320144861936569,
0.21976131200790405,
0.07286959886550903,
0.1643400341272354,... |
javascript/reference/errors/get_set_missing_private/index.md | JavaScript - Errors - Get set missing private - Examples - Accessing static elements on subclasses:
If you have a private static property, you can only access it on the class that declares it, not on subclasses.
Example:
class MyClass {
static #x = 0;
doSomething() {
console.log(this.#x);
}
}
class MySubC... | [
-1.0054117441177368,
-0.19525372982025146,
-0.7842849493026733,
0.282431960105896,
0.006012165918946266,
-1.3547368049621582,
1.2406301498413086,
0.5091041326522827,
-0.03196604177355766,
-0.014015371911227703,
-0.08159251511096954,
-0.10508229583501816,
-0.3262922465801239,
-1.45941257476... |
javascript/reference/errors/get_set_missing_private/index.md | JavaScript - Errors - Get set missing private - Examples - Accessing same-name private elements on another class:
Unlike normal string or symbol properties, private names are not shared between classes. If you have a private element with the same name in two classes, they are still not the same element, and you cannot... | [
-0.8225368857383728,
-0.10686652362346649,
-1.5197991132736206,
-0.4087420403957367,
0.002103301929309964,
-1.2212501764297485,
0.7888205647468567,
0.48465338349342346,
-0.4414224624633789,
-0.26018860936164856,
0.12002111226320267,
-0.21998295187950134,
-0.9097318053245544,
-1.27855920791... |
javascript/reference/errors/get_set_missing_private/index.md | JavaScript - Errors - Get set missing private - Examples - Adding private elements to unrelated objects:
You cannot dynamically add private elements to unrelated objects.
Example:
class MyClass {
#x = 0;
static stamp(obj) {
obj.#x = 1;
}
}
MyClass.stamp({});
// TypeError: can't set private field: object i... | [
-1.3527833223342896,
0.15659376978874207,
-0.9630016684532166,
0.1685905009508133,
0.1024966612458229,
-1.343665599822998,
1.3039554357528687,
0.6369339227676392,
0.002183386357501149,
-0.010718710720539093,
-0.08737953752279282,
0.48552778363227844,
-0.6732993125915527,
-0.592951893806457... |
javascript/reference/errors/bad_super_call/index.md | JavaScript - Errors - Bad super call:
The JavaScript exception "super() is only valid in derived class constructors" occurs when the `super()` call is used somewhere that's not the body of a constructor in a class with `extends` keyword. | [
-0.8658046722412109,
-0.09923025220632553,
-0.8018611669540405,
0.7979158163070679,
-0.42826226353645325,
-1.4785733222961426,
0.2445332258939743,
0.370914101600647,
-1.4170947074890137,
0.006155016366392374,
-0.9709352254867554,
-0.20955343544483185,
-0.8073632121086121,
-0.69762718677520... |
javascript/reference/errors/bad_super_call/index.md | JavaScript - Errors - Bad super call - Message:
Example:
SyntaxError: 'super' keyword unexpected here (V8-based)
SyntaxError: super() is only valid in derived class constructors (Firefox)
SyntaxError: super is not valid in this context. (Safari) | [
-0.8246257901191711,
0.27226522564888,
-0.7995675206184387,
0.033574409782886505,
-0.696865439414978,
-1.515480875968933,
0.3555052578449249,
1.1948035955429077,
-0.5965601801872253,
0.2971048653125763,
-0.5391253232955933,
0.2579454481601715,
-0.33635810017585754,
-0.4739151895046234,
-... |
javascript/reference/errors/bad_super_call/index.md | JavaScript - Errors - Bad super call - Error type:
`SyntaxError` | [
-0.43758857250213623,
0.19817562401294708,
-0.994104266166687,
-0.35816431045532227,
-0.48827606439590454,
-0.24677376449108124,
0.6702138781547546,
2.3266959190368652,
-0.8551070094108582,
-0.3522254526615143,
-0.1597084254026413,
0.2862733006477356,
-0.05330807343125343,
-0.1930408626794... |
javascript/reference/errors/bad_super_call/index.md | JavaScript - Errors - Bad super call - What went wrong?:
The `super()` call is used to invoke the base constructor of a derived class, so the base class can initialize the `this` object. Using it anywhere else doesn't make sense.
`super()` can also be defined in an arrow function that's nested within the constructor.... | [
-0.1813410520553589,
-0.05340263247489929,
-1.7632362842559814,
1.1057466268539429,
0.05795734003186226,
-1.1135143041610718,
0.14419345557689667,
0.44987809658050537,
-0.7539540529251099,
0.405913382768631,
-0.7646316289901733,
0.3548011779785156,
-0.06432022154331207,
-0.4930995106697082... |
javascript/reference/errors/bad_super_call/index.md | JavaScript - Errors - Bad super call - Examples - Invalid cases:
You cannot call `super()` if the class has no `extends`, because there's no base class to call:
Example:
class Base {
constructor() {
super();
}
}
You cannot call `super()` in a class method, even if that method is called from the constructor:... | [
-0.2979847192764282,
0.6404547691345215,
-1.178726315498352,
0.535264253616333,
-0.06381639838218689,
-1.3856587409973145,
-0.3194303512573242,
0.7223883867263794,
-0.755368709564209,
-0.015053009614348412,
-0.45120593905448914,
0.5859857797622681,
-0.6781668066978455,
-0.8342850804328918,... |
javascript/reference/errors/bad_super_call/index.md | JavaScript - Errors - Bad super call - Examples - Valid cases:
You can call `super()` before calling any other method in the constructor:
Example:
class Base {}
class Derived extends Base {
constructor() {
super();
this.init();
}
init() {
// …
}
}
You can call `super()` in an arrow function th... | [
0.3858720362186432,
0.34518197178840637,
-1.1088192462921143,
0.927024245262146,
0.29609158635139465,
-0.6454250812530518,
-0.3774125576019287,
0.9699796438217163,
-0.3443652093410492,
-0.12378671765327454,
-0.40302780270576477,
0.41433608531951904,
-0.29315969347953796,
0.0296029299497604... |
javascript/reference/errors/undeclared_private_field_or_method/index.md | JavaScript - Errors - Undeclared private field or method:
The JavaScript exception "reference to undeclared private field or method #x" occurs when a private name is used, but this private name is not declared in the class scope. | [
-0.8421676754951477,
-0.03858695179224014,
-1.3867460489273071,
0.2535852789878845,
-1.0003321170806885,
-0.7865977883338928,
1.8126977682113647,
0.23129351437091827,
-0.6135852336883545,
-0.3913435637950897,
0.1842580884695053,
-0.5540048480033875,
-0.467321515083313,
-1.0324450731277466,... |
javascript/reference/errors/undeclared_private_field_or_method/index.md | JavaScript - Errors - Undeclared private field or method - Message:
Example:
SyntaxError: Private field '#x' must be declared in an enclosing class (V8-based)
SyntaxError: reference to undeclared private field or method #x (Firefox)
SyntaxError: Cannot reference undeclared private names: "#x" (Safari) | [
-1.2585123777389526,
-0.010692383162677288,
-0.9402560591697693,
-0.09004625678062439,
-1.143904209136963,
-1.2470036745071411,
1.732867956161499,
0.5407779812812805,
-0.7069449424743652,
-0.17453114688396454,
0.36936280131340027,
-0.028606131672859192,
-0.2407606840133667,
-0.797029793262... |
javascript/reference/errors/undeclared_private_field_or_method/index.md | JavaScript - Errors - Undeclared private field or method - Error type:
`SyntaxError` | [
-0.4573182463645935,
0.18163825571537018,
-0.7697978615760803,
-0.2509599030017853,
-0.7200521230697632,
-0.7629924416542053,
1.3119227886199951,
1.607029676437378,
-0.4467267692089081,
-0.7664675712585449,
0.49954235553741455,
0.14229103922843933,
-0.41370129585266113,
-0.315560519695282,... |
javascript/reference/errors/undeclared_private_field_or_method/index.md | JavaScript - Errors - Undeclared private field or method - What went wrong?:
Unlike normal string or symbol properties, which return `undefined` if the property does not exist, private names are very strict and can only be legally accessed if they actually exist. Accessing an undeclared private name will result in a s... | [
-0.7258679866790771,
0.29121726751327515,
-0.9195960164070129,
0.22383113205432892,
-0.4542876183986664,
-1.3698443174362183,
1.3839932680130005,
0.30170944333076477,
-0.3131055533885956,
-0.2872334420681,
-0.13546012341976166,
-0.4047843813896179,
-0.6686772704124451,
-1.2941300868988037,... |
javascript/reference/errors/undeclared_private_field_or_method/index.md | JavaScript - Errors - Undeclared private field or method - Examples - Undeclared private field:
You cannot access a private field that is not declared in the class scope.
Example:
class MyClass {
doSomething() {
console.log(this.#x);
}
}
The same error occurs if you use the `in` operator to perform a check ... | [
-0.07140319049358368,
-0.1668396294116974,
-0.9017369747161865,
0.261243611574173,
0.3161776661872864,
0.08426672965288162,
0.8902446627616882,
0.9872416257858276,
-0.498069167137146,
-0.21382363140583038,
0.03167703375220299,
-0.032450009137392044,
0.05493183061480522,
-0.1726712286472320... |
javascript/reference/errors/read-only/index.md | JavaScript - Errors - Read-only:
The JavaScript strict mode-only exception "is read-only" occurs when a global variable or object property that was assigned to is a read-only property. | [
-0.5794097781181335,
0.27814388275146484,
-0.6216760873794556,
0.3981589376926422,
-0.2531281113624573,
-1.0613597631454468,
0.19255708158016205,
1.0862430334091187,
0.07074908912181854,
-0.20650488138198853,
-1.220747470855713,
-1.5677053928375244,
-0.5576597452163696,
-0.0952286571264267... |
javascript/reference/errors/read-only/index.md | JavaScript - Errors - Read-only - Message:
Example:
TypeError: Cannot assign to read only property 'x' of #<Object> (V8-based)
TypeError: "x" is read-only (Firefox)
TypeError: Attempted to assign to readonly property. (Safari) | [
-1.1220142841339111,
0.5808236598968506,
-0.6720738410949707,
-0.5040149092674255,
-0.5650045871734619,
-0.7956092357635498,
0.7569547295570374,
1.2962617874145508,
0.07298441976308823,
-0.4839620888233185,
-0.13131782412528992,
-1.2810221910476685,
-0.13631832599639893,
-0.691234290599823... |
javascript/reference/errors/read-only/index.md | JavaScript - Errors - Read-only - Error type:
`TypeError` in strict mode only. | [
-0.56618332862854,
0.043769218027591705,
-0.6291369199752808,
-0.21073982119560242,
-0.202872171998024,
0.4405243694782257,
0.30364009737968445,
1.893418312072754,
0.14734883606433868,
-0.4340164363384247,
-0.4628308117389679,
-1.4914734363555908,
-0.05008970573544502,
-0.5994128584861755,... |
javascript/reference/errors/read-only/index.md | JavaScript - Errors - Read-only - What went wrong?:
The global variable or object property that was assigned to is a read-only property. (Technically, it is a non-writable data property.)
This error happens only in strict mode code. In non-strict code, the assignment is silently ignored. | [
-1.316329002380371,
0.7181138396263123,
-0.6239336133003235,
-0.11385495960712433,
-0.29577410221099854,
-1.5322214365005493,
0.1601828783750534,
0.8747966289520264,
0.06266465038061142,
-0.19670771062374115,
-0.8421540260314941,
-1.445483684539795,
-0.16524513065814972,
0.0924486294388771... |
javascript/reference/errors/read-only/index.md | JavaScript - Errors - Read-only - Examples - Invalid cases:
Read-only properties are not super common, but they can be created using `Object.defineProperty()` or `Object.freeze()`.
Example:
"use strict";
const obj = Object.freeze({ name: "Elsa", score: 157 });
obj.score = 0; // TypeError
("use strict");
Object.defi... | [
-1.384830117225647,
0.8541082143783569,
-0.49231141805648804,
0.11877040565013885,
0.4276592433452606,
-0.5874589681625366,
0.43006572127342224,
0.5688721537590027,
0.009932246059179306,
0.30686816573143005,
-0.5941371321678162,
-0.6563927531242371,
0.6079391837120056,
-0.47945305705070496... |
javascript/reference/errors/read-only/index.md | JavaScript - Errors - Read-only - Examples - Valid cases:
Example:
"use strict";
let obj = Object.freeze({ name: "Score", points: 157 });
obj = { name: obj.name, points: 0 }; // replacing it with a new object works | [
-0.3969151973724365,
0.22018422186374664,
-0.9401717782020569,
0.3601388931274414,
0.5368858575820923,
-1.416957139968872,
1.172157883644104,
0.007954837754368782,
-0.2334696501493454,
-0.04029809683561325,
-0.35108891129493713,
-0.6959613561630249,
0.10515853762626648,
-0.0923520103096962... |
javascript/reference/errors/duplicate_proto/index.md | JavaScript - Errors - Duplicate proto:
The JavaScript exception "property name proto appears more than once in object literal" occurs when an object literal contains multiple occurrences of the `__proto__` field, which is used to set the prototype of this new object. | [
-1.1572738885879517,
-0.37928885221481323,
-0.3398241102695465,
0.9567298889160156,
-0.32689258456230164,
-0.8872277140617371,
0.268894225358963,
0.24596524238586426,
-0.9044744372367859,
-0.5525475740432739,
-0.90605229139328,
-0.4869861602783203,
-0.47656992077827454,
-0.836664617061615,... |
javascript/reference/errors/duplicate_proto/index.md | JavaScript - Errors - Duplicate proto - Message:
Example:
SyntaxError: Duplicate __proto__ fields are not allowed in object literals (V8-based)
SyntaxError: property name __proto__ appears more than once in object literal (Firefox)
SyntaxError: Attempted to redefine __proto__ property. (Safari) | [
-1.6933846473693848,
-0.038520194590091705,
-0.15191718935966492,
-0.030701568350195885,
-0.5162938237190247,
-0.9618128538131714,
0.3870464563369751,
0.9662471413612366,
-0.6686512231826782,
-0.8699970841407776,
-0.3595876395702362,
-0.48162490129470825,
0.0659661591053009,
-1.07060241699... |
javascript/reference/errors/duplicate_proto/index.md | JavaScript - Errors - Duplicate proto - Error type:
`SyntaxError` | [
-0.2943410873413086,
0.06949383020401001,
-0.3034442067146301,
0.049506161361932755,
-0.872282087802887,
0.08015669882297516,
0.8200007081031799,
2.4552156925201416,
-0.4978541135787964,
-0.7360631227493286,
-0.09542913734912872,
-0.32592612504959106,
-0.010607898235321045,
-0.481894314289... |
javascript/reference/errors/duplicate_proto/index.md | JavaScript - Errors - Duplicate proto - What went wrong?:
The `__proto__` key, unlike other property keys, is a special syntax in an object literal. It is used to set the prototype of the object being created and is not allowed to appear more than once in an object literal. Note that this restriction only applies to t... | [
-0.7692708969116211,
0.22098977863788605,
-0.27970078587532043,
0.2796024978160858,
0.022703183814883232,
-1.0180376768112183,
0.003983556292951107,
1.2420765161514282,
-0.34294629096984863,
-0.4814770519733429,
-0.6794407963752747,
0.35007748007774353,
-0.2703078091144562,
-0.515933692455... |
javascript/reference/errors/duplicate_proto/index.md | JavaScript - Errors - Duplicate proto - Examples - Invalid cases:
Example:
const obj = { __proto__: {}, __proto__: { a: 1 } }; | [
-0.26420512795448303,
0.3368469476699829,
-0.8815123438835144,
-0.03914722055196762,
-0.42220163345336914,
-0.47296833992004395,
0.1725652515888214,
1.3524596691131592,
-0.8681525588035583,
0.02819403074681759,
-0.5783182382583618,
-0.5444575548171997,
0.44232940673828125,
-0.5061878561973... |
javascript/reference/errors/duplicate_proto/index.md | JavaScript - Errors - Duplicate proto - Examples - Valid cases:
Example:
// Only setting the prototype once
const obj = { __proto__: { a: 1 } };
// These syntaxes all create a property called "__proto__" and can coexist
// They would overwrite each other and the last one is actually used
const __proto__ = null;
cons... | [
-0.033348195254802704,
0.7549557089805603,
-0.7133030295372009,
0.6086098551750183,
0.04419988766312599,
-0.9204213619232178,
0.48765885829925537,
1.5651274919509888,
-0.2147214114665985,
0.16366909444332123,
-0.8379907608032227,
-0.28216031193733215,
0.9031453132629395,
-0.593836486339569... |
javascript/reference/errors/function_label/index.md | JavaScript - Errors - Function label:
The JavaScript exception "functions cannot be labelled" occurs when a `function` declaration has a label before it. | [
-0.8017172813415527,
0.13878978788852692,
-0.851350724697113,
0.39618343114852905,
-0.48544129729270935,
-1.2588032484054565,
-0.8665086030960083,
1.3338838815689087,
-1.1410901546478271,
-0.9353965520858765,
0.1466130018234253,
-0.71084064245224,
-0.2269945740699768,
-0.49691078066825867,... |
javascript/reference/errors/function_label/index.md | JavaScript - Errors - Function label - Message:
Example:
SyntaxError: In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement. (V8-based)
SyntaxError: In strict mode code, functions can only be declared at top level or inside a block. (V8-based)
SyntaxEr... | [
-0.22794213891029358,
0.4418516457080841,
-0.7970383763313293,
0.2892363965511322,
-0.22196640074253082,
-1.3915390968322754,
-0.4543944299221039,
1.3240482807159424,
-0.5571503639221191,
-0.17112143337726593,
0.011093941517174244,
-0.27711498737335205,
0.16763916611671448,
0.5998528003692... |
javascript/reference/errors/function_label/index.md | JavaScript - Errors - Function label - Error type:
`SyntaxError` | [
-0.9705415368080139,
0.18519394099712372,
-0.7869048118591309,
-0.02200287953019142,
-0.44478023052215576,
-0.8917809128761292,
0.7333446145057678,
1.989704966545105,
-0.32509204745292664,
-0.9892603754997253,
0.28418898582458496,
-0.1493982970714569,
-0.029380079358816147,
0.0030541152227... |
javascript/reference/errors/function_label/index.md | JavaScript - Errors - Function label - What went wrong?:
Function declarations are never supposed to be labeled, because labels should only apply to statements, not declarations. There's no way to actually jump to this label. However, due to some legacy JavaScript syntax rules, the error condition is a bit more compli... | [
-0.9962952733039856,
0.0529400110244751,
-1.1286466121673584,
0.29344072937965393,
-0.1392396092414856,
-1.351677656173706,
-0.9755385518074036,
0.898616373538971,
-0.5579022169113159,
-0.5118948817253113,
0.07971630245447159,
-0.4695971608161926,
-0.3357522785663605,
0.35021135210990906,
... |
javascript/reference/errors/function_label/index.md | JavaScript - Errors - Function label - Examples - Misparsed object literal:
While it's possible that you actually expect the label to do something along the lines of being a jump target, usually you didn't intend for it to be a label. The most common case is you actually want it to be a property key in an object liter... | [
-1.322301983833313,
0.40805259346961975,
-0.5382719039916992,
0.11713527888059616,
0.11122439056634903,
-2.166738748550415,
-0.6921015977859497,
0.48988574743270874,
-0.3193494379520416,
-0.5739125609397888,
0.14009511470794678,
0.09378642588853836,
-0.2568514943122864,
-0.5691571831703186... |
javascript/reference/errors/bigint_not_serializable/index.md | JavaScript - Errors - BigInt not serializable:
The JavaScript exception "BigInt value can't be serialized in JSON" occurs when a `BigInt` is encountered in `JSON.stringify` with no custom serialization method provided. | [
-0.913586437702179,
-0.00930573046207428,
-1.2266396284103394,
-0.3827163875102997,
-0.20576496422290802,
-0.8248615264892578,
-0.6889054775238037,
1.1101951599121094,
-0.8134571313858032,
-0.674883246421814,
0.32156845927238464,
-0.5651310086250305,
0.3110811114311218,
-0.5651648640632629... |
javascript/reference/errors/bigint_not_serializable/index.md | JavaScript - Errors - BigInt not serializable - Message:
Example:
TypeError: Do not know how to serialize a BigInt (V8-based)
TypeError: BigInt value can't be serialized in JSON (Firefox)
TypeError: JSON.stringify cannot serialize BigInt. (Safari) | [
-1.7855058908462524,
0.10526695847511292,
-1.3698073625564575,
-0.5171947479248047,
-0.43928802013397217,
-0.41478249430656433,
-0.40778273344039917,
1.1424044370651245,
-0.6232814788818359,
-0.8858925104141235,
0.2897890508174896,
-0.6512608528137207,
-0.08069682866334915,
-0.700607478618... |
javascript/reference/errors/bigint_not_serializable/index.md | JavaScript - Errors - BigInt not serializable - Error type:
`TypeError` | [
-0.8998948931694031,
0.3036648631095886,
-0.7519933581352234,
-0.751650333404541,
-0.1680721491575241,
0.35859382152557373,
-0.42612048983573914,
1.86445152759552,
-0.9058652520179749,
-0.8543224334716797,
0.4302043616771698,
-0.5837530493736267,
0.27453118562698364,
-0.4455432593822479,
... |
javascript/reference/errors/bigint_not_serializable/index.md | JavaScript - Errors - BigInt not serializable - What went wrong?:
You are trying to serialize a BigInt value using `JSON.stringify`, which does not support BigInt values by default. Sometimes, JSON stringification happens implicitly in libraries, as part of data serialization. For example, sending data to the server, ... | [
-1.3071671724319458,
-0.08568784594535828,
-1.2264527082443237,
-0.14811889827251434,
0.165066659450531,
-1.1192970275878906,
-0.2573661506175995,
0.8310800194740295,
-0.46412593126296997,
-0.12482281774282455,
-0.05733722448348999,
-0.13187146186828613,
-0.29518577456474304,
-0.2436997890... |
javascript/reference/errors/bigint_not_serializable/index.md | JavaScript - Errors - BigInt not serializable - Examples - Providing a custom serialization method:
By default, BigInt values are not serializable in JSON:
Example:
const data = { a: 1n };
JSON.stringify(data);
// TypeError: BigInt value can't be serialized in JSON
Assuming you intend for the JSON to contain a numb... | [
-0.825613260269165,
-0.02885066531598568,
-1.1409635543823242,
-0.6578952670097351,
0.1705915778875351,
-0.9234694838523865,
-0.18959571421146393,
1.0798228979110718,
-0.41419804096221924,
-0.27235114574432373,
0.033701859414577484,
0.1897396296262741,
-0.07476680725812912,
-0.668701469898... |
javascript/reference/errors/await_yield_in_parameter/index.md | JavaScript - Errors - await yield in parameter:
The JavaScript exception "await expression can't be used in parameter" or "yield expression can't be used in parameter" occurs when the default parameter expression contains the `await` or `yield` keyword and has the effect of pausing default parameter evaluation. | [
-0.4853615462779999,
0.2698811888694763,
-1.42191743850708,
0.5220710039138794,
-0.6638216972351074,
-1.3536006212234497,
0.09654345363378525,
1.4207466840744019,
-0.550152063369751,
-0.5295737385749817,
-0.5268822312355042,
-0.3893078565597534,
-0.2633703052997589,
0.08355247974395752,
... |
javascript/reference/errors/await_yield_in_parameter/index.md | JavaScript - Errors - await yield in parameter - Message:
Example:
SyntaxError: Illegal await-expression in formal parameters of async function (V8-based)
SyntaxError: await expression can't be used in parameter (Firefox)
SyntaxError: Cannot use 'await' within a parameter default expression. (Safari)
SyntaxError: Yi... | [
-0.6029013991355896,
0.4482648968696594,
-1.1500617265701294,
-0.13474950194358826,
-0.9862595796585083,
-1.3102188110351562,
0.021518105641007423,
1.323683261871338,
0.16166168451309204,
-0.571570634841919,
-0.234846293926239,
-0.08235345780849457,
-0.630526065826416,
0.13831615447998047,... |
javascript/reference/errors/await_yield_in_parameter/index.md | JavaScript - Errors - await yield in parameter - Error type:
`SyntaxError` | [
-0.7538635730743408,
0.3132244944572449,
-1.1543203592300415,
-0.14910496771335602,
-0.8958956003189087,
-0.6360422372817993,
0.19927994906902313,
2.376648187637329,
-0.3613077402114868,
-0.9428679347038269,
0.5123816132545471,
-0.19505688548088074,
-0.4426438510417938,
0.5548617839813232,... |
javascript/reference/errors/await_yield_in_parameter/index.md | JavaScript - Errors - await yield in parameter - What went wrong?:
The default expression must be able to evaluate synchronously. If it contains an `await` or `yield` expression, it will pause the evaluation of the default expression, which is not allowed.
Note: This error is only generated when `await` or `yield` ar... | [
-0.7164910435676575,
0.6282587051391602,
-1.2983320951461792,
-0.11558178812265396,
-0.4765220582485199,
-0.8684098124504089,
0.03630577772855759,
1.8774574995040894,
-0.06864474713802338,
-0.1982029676437378,
-0.5948721766471863,
-0.5289595127105713,
-0.4542516767978668,
0.414233833551406... |
javascript/reference/errors/await_yield_in_parameter/index.md | JavaScript - Errors - await yield in parameter - Examples - Invalid cases:
Example:
function *gen(a = yield 1) {}
async function f(a = await Promise.resolve(1)) {} | [
-0.8136691451072693,
0.8301170468330383,
-1.207804799079895,
-0.9440166354179382,
-0.5052478909492493,
-0.6301372647285461,
0.3371186852455139,
1.5787875652313232,
-0.6563432216644287,
-0.5427097082138062,
-0.25365695357322693,
-0.20854239165782928,
-0.3264622390270233,
0.335834264755249,
... |
javascript/reference/errors/await_yield_in_parameter/index.md | JavaScript - Errors - await yield in parameter - Examples - Valid cases:
You can use the nullish coalescing assignment to provide a default value instead. If you want to treat `null` and `undefined` differently, you would need to use a condition.
Example:
function* gen(a) {
a ??= yield 1;
}
async function f(a) {
... | [
-1.3058266639709473,
0.7463861107826233,
-1.214752197265625,
0.563666820526123,
-0.4415198564529419,
-1.3736770153045654,
1.0070867538452148,
1.1053906679153442,
0.09713427722454071,
0.2073761373758316,
-0.35040348768234253,
0.36800187826156616,
0.4036201536655426,
0.6216808557510376,
-0... |
javascript/reference/errors/unexpected_type/index.md | JavaScript - Errors - Unexpected type:
The JavaScript exception "x is (not) y" occurs when there was an unexpected type. Oftentimes, unexpected `undefined` or `null` values. | [
-0.7567225694656372,
-0.3676985204219818,
-1.14842689037323,
0.7963123321533203,
-0.637450635433197,
-1.1271127462387085,
0.4183881878852844,
1.448812484741211,
0.1696135550737381,
0.07716283947229385,
-0.15071861445903778,
-0.4572477340698242,
-0.45432049036026,
-0.48730626702308655,
-0... |
javascript/reference/errors/unexpected_type/index.md | JavaScript - Errors - Unexpected type - Message:
Example:
TypeError: Cannot read properties of undefined (reading 'x') (V8-based)
TypeError: "x" is undefined (Firefox)
TypeError: "undefined" is not an object (Firefox)
TypeError: undefined is not an object (evaluating 'obj.x') (Safari)
TypeError: "x" is not a symbol ... | [
-0.7904911041259766,
0.4646140933036804,
-1.1600399017333984,
-0.22656914591789246,
-0.7692296504974365,
-0.4675440788269043,
0.9336202144622803,
0.7321233153343201,
0.25525614619255066,
-0.1496630758047104,
0.5684254169464111,
-0.7634848952293396,
0.14064013957977295,
-0.32821571826934814... |
javascript/reference/errors/unexpected_type/index.md | JavaScript - Errors - Unexpected type - Error type:
`TypeError`. | [
-0.22379572689533234,
-0.034013375639915466,
-0.8224003314971924,
-0.15808352828025818,
-0.4648239314556122,
0.5553281903266907,
0.6849212050437927,
2.257225513458252,
0.20065635442733765,
-1.1763615608215332,
0.3399868905544281,
-0.1835690587759018,
-0.4959608018398285,
-0.290575653314590... |
javascript/reference/errors/unexpected_type/index.md | JavaScript - Errors - Unexpected type - What went wrong?:
There was an unexpected type. This occurs oftentimes with `undefined` or `null` values.
Also, certain methods, such as `Object.create()` or `Symbol.keyFor()`, require a specific type, that must be provided. | [
-1.2096595764160156,
-0.1948699951171875,
-1.3226131200790405,
0.7142800688743591,
-0.16690579056739807,
-0.6918455958366394,
0.10342074185609818,
1.575487494468689,
-0.6585614681243896,
-0.3294837176799774,
-0.3681698739528656,
-0.3079304099082947,
-0.3224122226238251,
-0.2395294606685638... |
javascript/reference/errors/unexpected_type/index.md | JavaScript - Errors - Unexpected type - Examples - Invalid cases:
You cannot invoke a method on an `undefined` or `null` variable.
Example:
const foo = undefined;
foo.substring(1); // TypeError: foo is undefined
const foo2 = null;
foo2.substring(1); // TypeError: foo2 is null
Certain methods might require a specif... | [
-0.11601164191961288,
0.5246862173080444,
-1.3997653722763062,
0.9337583780288696,
0.10914403945207596,
-1.699317455291748,
0.7122803926467896,
1.2148994207382202,
-0.8912700414657593,
0.16075079143047333,
-0.17872996628284454,
-0.4336305558681488,
0.8690923452377319,
-0.5016131401062012,
... |
javascript/reference/errors/unexpected_type/index.md | JavaScript - Errors - Unexpected type - Examples - Fixing the issue:
To fix null pointer to `undefined` or `null` values, you can test if the value is `undefined` or `null` first.
Example:
if (foo !== undefined && foo !== null) {
// Now we know that foo is defined, we are good to go.
}
Or, if you are confident th... | [
-0.8952205777168274,
0.284976065158844,
-0.9834935069084167,
0.8716844320297241,
-0.25032663345336914,
-1.1804412603378296,
2.152395725250244,
1.4999476671218872,
-0.13981059193611145,
1.0028892755508423,
-0.023698603734374046,
-0.887010395526886,
0.42470529675483704,
-0.09471821039915085,... |
javascript/reference/errors/cant_access_lexical_declaration_before_init/index.md | JavaScript - Errors - Cant access lexical declaration before init:
The JavaScript exception "can't access lexical declaration 'X' before initialization" occurs when a lexical variable was accessed before it was initialized. This happens within any scope (global, module, function, or block) when `let` or `const` variab... | [
-0.11452799290418625,
0.37375974655151367,
-0.18992280960083008,
0.44069910049438477,
-0.9341978430747986,
-1.5618250370025635,
-0.8281580209732056,
0.5293717980384827,
-0.7217460870742798,
-0.5918652415275574,
0.44333595037460327,
-1.2660170793533325,
0.20950400829315186,
-0.8884870409965... |
javascript/reference/errors/cant_access_lexical_declaration_before_init/index.md | JavaScript - Errors - Cant access lexical declaration before init - Message:
Example:
ReferenceError: Cannot access 'X' before initialization (V8-based)
ReferenceError: can't access lexical declaration 'X' before initialization (Firefox)
ReferenceError: Cannot access uninitialized variable. (Safari) | [
-0.7240269780158997,
0.5794318318367004,
-0.756540834903717,
-0.1862693578004837,
-1.2835556268692017,
-1.0961439609527588,
0.0942864865064621,
1.1332361698150635,
-0.700646698474884,
-0.7014768123626709,
0.6730572581291199,
-1.347618579864502,
0.4361725151538849,
-0.8580378293991089,
-0... |
javascript/reference/errors/cant_access_lexical_declaration_before_init/index.md | JavaScript - Errors - Cant access lexical declaration before init - Error type:
`ReferenceError` | [
-0.39418554306030273,
0.7007121443748474,
-0.510415256023407,
-0.04292787238955498,
-1.0157268047332764,
-0.0752972736954689,
0.3345004916191101,
1.3293229341506958,
-0.6135327219963074,
-1.2913159132003784,
0.5224273204803467,
-1.063668131828308,
0.3524072468280792,
-0.8145496845245361,
... |
javascript/reference/errors/cant_access_lexical_declaration_before_init/index.md | JavaScript - Errors - Cant access lexical declaration before init - What went wrong?:
A lexical variable was accessed before it was initialized. This happens within any scope (global, module, function, or block) when variables declared with `let` or `const` are accessed before the place where they are declared has bee... | [
0.26829972863197327,
0.5215669870376587,
-0.5300289392471313,
0.3112492859363556,
-0.7778016924858093,
-1.278753399848938,
-0.7018707990646362,
0.5284824967384338,
-0.603476345539093,
0.28273847699165344,
0.5876867175102234,
-1.0330843925476074,
-0.018958523869514465,
-0.6969363689422607,
... |
javascript/reference/errors/cant_access_lexical_declaration_before_init/index.md | JavaScript - Errors - Cant access lexical declaration before init - Examples - Invalid cases:
In this case, the variable `foo` is accessed before it is declared. At this point foo has not been initialized with a value, so accessing the variable throws a reference error.
Example:
function test() {
// Accessing the ... | [
0.0431065559387207,
0.6022379994392395,
-1.0208077430725098,
0.8017621040344238,
-0.669910728931427,
-0.9901449084281921,
-0.1976976990699768,
1.0301069021224976,
-0.7577237486839294,
0.49710720777511597,
0.6268563270568848,
-0.42090079188346863,
0.7726573944091797,
-0.36705300211906433,
... |
javascript/reference/errors/cant_access_lexical_declaration_before_init/index.md | JavaScript - Errors - Cant access lexical declaration before init - Examples - Valid cases:
In the following example, we correctly declare a variable using the `const` keyword before accessing it.
Example:
function test() {
// Declaring variable foo
const foo = 33;
console.log(foo); // 33
}
test();
In this ex... | [
0.14750705659389496,
0.18757189810276031,
-0.9931285977363586,
1.0785330533981323,
-0.5864225029945374,
-1.21659517288208,
-0.6613713502883911,
0.6256609559059143,
-0.6504606604576111,
0.5989065170288086,
0.7027305364608765,
0.060583535581827164,
0.5051608085632324,
-0.4644656479358673,
... |
javascript/reference/errors/missing_formal_parameter/index.md | JavaScript - Errors - Missing formal parameter:
The JavaScript exception "missing formal parameter" occurs when your function declaration is missing valid parameters. | [
-0.6241495013237,
-0.38159000873565674,
-0.9590560793876648,
0.22804753482341766,
-0.45251309871673584,
-0.8843871355056763,
0.6228470206260681,
0.7345441579818726,
-1.1227697134017944,
-0.07098295539617538,
-0.37671399116516113,
-1.5119894742965698,
-0.3893057107925415,
-0.004154069349169... |
javascript/reference/errors/missing_formal_parameter/index.md | JavaScript - Errors - Missing formal parameter - Message:
Example:
SyntaxError: missing formal parameter (Firefox)
SyntaxError: Unexpected number '3'. Expected a parameter pattern or a ')' in parameter list. (Safari)
SyntaxError: Unexpected string literal "x". Expected a parameter pattern or a ')' in parameter list. ... | [
-1.4766488075256348,
-0.2781313955783844,
-1.313400387763977,
-0.8232505321502686,
-0.4385419487953186,
-1.1485137939453125,
1.134455919265747,
0.7940355539321899,
-0.8056180477142334,
0.014935324899852276,
0.06415136158466339,
-0.21873164176940918,
-0.17225131392478943,
-0.288731426000595... |
javascript/reference/errors/missing_formal_parameter/index.md | JavaScript - Errors - Missing formal parameter - Error type:
`SyntaxError` | [
-0.9063805341720581,
0.103671133518219,
-0.5390508770942688,
-0.43957948684692383,
-0.5155531764030457,
-0.664566695690155,
1.3968673944473267,
1.649977684020996,
-0.9088121652603149,
-0.7544823884963989,
0.4407427906990051,
-0.7256410717964172,
-0.10525712370872498,
0.2625109553337097,
... |
javascript/reference/errors/missing_formal_parameter/index.md | JavaScript - Errors - Missing formal parameter - What went wrong?:
"Formal parameter" is a fancy way of saying "function parameter". Your function declaration is missing valid parameters. In the declaration of a function, the parameters must be identifiers, not any value like numbers, strings, or objects. Declaring fu... | [
-0.4920405447483063,
-0.709048867225647,
-1.2948588132858276,
0.40561994910240173,
-0.0977361723780632,
-1.3714420795440674,
0.5326116681098938,
-0.053279031068086624,
-0.6785041689872742,
0.3634900450706482,
-0.47907155752182007,
-0.5845204591751099,
-0.3992525339126587,
0.001531561603769... |
javascript/reference/errors/missing_formal_parameter/index.md | JavaScript - Errors - Missing formal parameter - Examples - Provide proper function parameters:
Function parameters must be identifiers when setting up a function. All these function declarations fail, as they are providing values for their parameters:
Example:
function square(3) {
return number * number;
}
// Syn... | [
-0.4709290564060211,
0.33958137035369873,
-1.889845848083496,
0.10418104380369186,
0.06984569877386093,
-1.1745572090148926,
0.5718609690666199,
-0.5239904522895813,
-0.31306207180023193,
0.14734889566898346,
-0.4967530071735382,
0.10977397114038467,
0.48603585362434387,
-0.365652978420257... |
javascript/reference/errors/invalid_const_assignment/index.md | JavaScript - Errors - Invalid const assignment:
The JavaScript exception "invalid assignment to const" occurs when it was attempted to alter a constant value. JavaScript `const` declarations can't be re-assigned or redeclared. | [
0.33180996775627136,
0.10187114030122757,
-0.8491650819778442,
0.41855388879776,
-0.2127980887889862,
-1.2585238218307495,
0.6668559312820435,
0.8605821132659912,
-0.46519362926483154,
-0.2632090747356415,
-0.3540797531604767,
-0.8990195393562317,
-0.19517172873020172,
0.06480330973863602,... |
javascript/reference/errors/invalid_const_assignment/index.md | JavaScript - Errors - Invalid const assignment - Message:
Example:
TypeError: Assignment to constant variable. (V8-based)
TypeError: invalid assignment to const 'x' (Firefox)
TypeError: Attempted to assign to readonly property. (Safari) | [
-0.6616548299789429,
0.0020813553128391504,
-0.8180438280105591,
0.04733216017484665,
-0.5498713254928589,
-1.0170845985412598,
1.1864453554153442,
0.7768315672874451,
-0.08732013404369354,
-0.38540273904800415,
0.3295808434486389,
-1.0659271478652954,
0.04922674968838692,
-0.3195545971393... |
javascript/reference/errors/invalid_const_assignment/index.md | JavaScript - Errors - Invalid const assignment - Error type:
`TypeError` | [
-0.11878842115402222,
-0.3071916103363037,
-0.9261177778244019,
-0.24409349262714386,
-0.4057687222957611,
0.7078961730003357,
0.917246401309967,
1.5204206705093384,
-0.1122535765171051,
-0.6599341034889221,
0.3145081102848053,
-0.3480892777442932,
0.023196959868073463,
-0.1168372184038162... |
javascript/reference/errors/invalid_const_assignment/index.md | JavaScript - Errors - Invalid const assignment - What went wrong?:
A constant is a value that cannot be altered by the program during normal execution. It cannot change through re-assignment, and it can't be redeclared. In JavaScript, constants are declared using the `const` keyword. | [
0.30506008863449097,
-0.2297867089509964,
-1.5132733583450317,
-0.029654158279299736,
0.2679744064807892,
-1.5373350381851196,
0.7664802074432373,
1.4804190397262573,
-0.3690590560436249,
-0.07516869902610779,
-0.7426902055740356,
-0.7620617747306824,
-0.4637269079685211,
0.475772738456726... |
javascript/reference/errors/invalid_const_assignment/index.md | JavaScript - Errors - Invalid const assignment - Examples - Invalid redeclaration:
Assigning a value to the same constant name in the same block-scope will throw.
Example:
const COLUMNS = 80;
// …
COLUMNS = 120; // TypeError: invalid assignment to const `COLUMNS' | [
0.026074392721056938,
0.2743384838104248,
-0.9447855949401855,
0.14773967862129211,
-0.06379468739032745,
-0.32985833287239075,
0.3564092814922333,
0.558631420135498,
-0.38652774691581726,
-0.00884074904024601,
-0.22533045709133148,
-0.47769996523857117,
0.39778050780296326,
0.490038752555... |
javascript/reference/errors/invalid_const_assignment/index.md | JavaScript - Errors - Invalid const assignment - Examples - Fixing the error:
There are multiple options to fix this error. Check what was intended to be achieved with the constant in question. | [
0.28795984387397766,
0.31385231018066406,
-0.7521986365318298,
0.1917731761932373,
-0.332150399684906,
-0.8400114178657532,
1.0437830686569214,
1.6028244495391846,
-0.3093399405479431,
-0.30992308259010315,
-0.10504399985074997,
-0.5533717274665833,
0.11782444268465042,
0.5251597762107849,... |
javascript/reference/errors/invalid_const_assignment/index.md | JavaScript - Errors - Invalid const assignment - Examples - Fixing the error - Rename:
If you meant to declare another constant, pick another name and re-name. This constant name is already taken in this scope.
Example:
const COLUMNS = 80;
const WIDE_COLUMNS = 120; | [
-0.4127395451068878,
0.04774242639541626,
-1.0905662775039673,
0.032219018787145615,
-0.33138716220855713,
-0.6834888458251953,
0.5017465949058533,
1.3022831678390503,
-0.5870682597160339,
-0.013065611943602562,
-0.4077325165271759,
0.0537736602127552,
-0.3167487382888794,
0.57546311616897... |
javascript/reference/errors/invalid_const_assignment/index.md | JavaScript - Errors - Invalid const assignment - Examples - Fixing the error - const, let or var?:
Do not use const if you weren't meaning to declare a constant. Maybe you meant to declare a block-scoped variable with `let` or global variable with `var`.
Example:
let columns = 80;
// …
columns = 120; | [
-0.2504793107509613,
-0.41253772377967834,
-1.5165791511535645,
0.3067733347415924,
-0.29703646898269653,
-1.028273582458496,
-0.6801748871803284,
0.6511678695678711,
-0.13998228311538696,
-0.12260619550943375,
0.4881064295768738,
0.426782488822937,
-0.07002715021371841,
0.6351449489593506... |
javascript/reference/errors/invalid_const_assignment/index.md | JavaScript - Errors - Invalid const assignment - Examples - Fixing the error - Scoping:
Check if you are in the correct scope. Should this constant appear in this scope or was it meant to appear in a function, for example?
Example:
const COLUMNS = 80;
function setupBigScreenEnvironment() {
const COLUMNS = 120;
} | [
-0.9018812775611877,
-0.38051074743270874,
-1.0205286741256714,
-0.13368238508701324,
0.06278751790523529,
-0.7847821712493896,
0.3775762617588043,
0.5667235851287842,
-0.34967541694641113,
-0.12671181559562683,
0.5476294755935669,
0.46646174788475037,
-0.07966357469558716,
0.2187464386224... |
javascript/reference/errors/invalid_const_assignment/index.md | JavaScript - Errors - Invalid const assignment - Examples - const and immutability:
The `const` declaration creates a read-only reference to a value. It does not mean the value it holds is immutable, just that the variable identifier cannot be reassigned. For instance, in case the content is an object, this means the ... | [
-0.03715788200497627,
-0.04098404198884964,
-1.2657661437988281,
0.513208270072937,
-0.013127514161169529,
-1.798799753189087,
0.5351695418357849,
1.1927852630615234,
0.28581199049949646,
0.2745491862297058,
-0.3262289762496948,
-0.6891810894012451,
0.2082253098487854,
0.4997670650482178,
... |
javascript/reference/errors/bad_continue/index.md | JavaScript - Errors - Bad continue:
The JavaScript exception "continue must be inside loop" occurs when a `continue` statement is not inside a loop statement. | [
-0.6845712065696716,
0.6622106432914734,
-1.4395331144332886,
0.3015114665031433,
-0.5694654583930969,
0.1308523714542389,
-0.4023546874523163,
1.1831741333007812,
-1.106481909751892,
-0.07070919126272202,
-0.7629122734069824,
-1.0267248153686523,
-0.5140814185142517,
-0.05114071071147919,... |
javascript/reference/errors/bad_continue/index.md | JavaScript - Errors - Bad continue - Message:
Example:
SyntaxError: Illegal continue statement: no surrounding iteration statement (V8-based)
SyntaxError: Illegal continue statement: 'label' does not denote an iteration statement (V8-based)
SyntaxError: continue must be inside loop (Firefox)
SyntaxError: 'continue' i... | [
-1.693285346031189,
0.8990098834037781,
-0.6227724552154541,
-0.3599250018596649,
-0.7130683660507202,
-0.8986876606941223,
-0.28428149223327637,
1.2472717761993408,
-0.6883710622787476,
0.19699446856975555,
-0.05487734451889992,
-0.5017483830451965,
-0.5120438933372498,
-0.344735652208328... |
javascript/reference/errors/bad_continue/index.md | JavaScript - Errors - Bad continue - Error type:
`SyntaxError`. | [
-0.3203872740268707,
0.14359255135059357,
-0.4726821482181549,
-0.5076298713684082,
-0.6348891258239746,
-0.2554382085800171,
1.0306384563446045,
2.861234664916992,
-0.8285820484161377,
-0.7769810557365417,
0.02735988050699234,
-0.6700460910797119,
-0.45178553462028503,
0.07920670509338379... |
javascript/reference/errors/bad_continue/index.md | JavaScript - Errors - Bad continue - What went wrong?:
`continue` statements can be used to continue a loop, and using them elsewhere is a syntax error. Alternatively, you can provide a label to the `continue` statement to continue any loop with that label — however, if the label does not reference a containing statem... | [
-1.2507236003875732,
1.0312860012054443,
-0.8757222890853882,
0.432372510433197,
-0.11227955669164658,
-1.079315185546875,
0.11665917187929153,
1.9945610761642456,
-0.7020339369773865,
0.0243662279099226,
0.006792515050619841,
-0.09284409135580063,
-0.8675724267959595,
0.5979830026626587,
... |
javascript/reference/errors/bad_continue/index.md | JavaScript - Errors - Bad continue - Examples - Using continue in callbacks:
If you want to proceed with the next iteration in a `forEach()` loop, use `return` instead, or convert it to a `for...of` loop.
Example:
array.forEach((value) => {
if (value === 5) {
continue; // SyntaxError: continue must be inside l... | [
-0.15191712975502014,
0.5522888898849487,
-0.4136961102485657,
0.7751367688179016,
-0.08157642930746078,
-0.21735677123069763,
0.5025784969329834,
1.226340889930725,
-1.6881603002548218,
0.12911227345466614,
-0.6229716539382935,
-0.23875963687896729,
0.2991807162761688,
0.29780665040016174... |
javascript/reference/errors/invalid_for-of_initializer/index.md | JavaScript - Errors - Invalid for-of initializer:
The JavaScript exception "a declaration in the head of a for-of loop can't have an initializer" occurs when the head of a for...of loop contains an initializer expression such as `for (const i = 0 of iterable)`. This is not allowed in for-of loops. | [
0.6499053835868835,
-0.035203076899051666,
-0.2839656174182892,
1.0601822137832642,
-0.34958943724632263,
-0.6910462975502014,
-0.356096088886261,
1.3621019124984741,
-1.1566908359527588,
-0.31631287932395935,
-0.3045692443847656,
-1.190904140472412,
-0.18498417735099792,
-0.17024116218090... |
javascript/reference/errors/invalid_for-of_initializer/index.md | JavaScript - Errors - Invalid for-of initializer - Message:
Example:
SyntaxError: for-of loop variable declaration may not have an initializer. (V8-based)
SyntaxError: a declaration in the head of a for-of loop can't have an initializer (Firefox)
SyntaxError: Cannot assign to the loop variable inside a for-of loop he... | [
-0.40866926312446594,
0.1806683987379074,
-0.5285727381706238,
0.34500235319137573,
-1.0100939273834229,
-0.5604846477508545,
0.07357505708932877,
1.7437283992767334,
-0.5546544194221497,
-0.5301918387413025,
1.017323613166809,
-1.355088472366333,
-0.35724174976348877,
-0.09696874022483826... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.