diff --git a/files/en-us/web/javascript/data_structures/index.md b/files/en-us/web/javascript/data_structures/index.md index 2c4caa5b8252650..5614685ded216d6 100644 --- a/files/en-us/web/javascript/data_structures/index.md +++ b/files/en-us/web/javascript/data_structures/index.md @@ -78,7 +78,7 @@ console.log(42 / +0); // Infinity console.log(42 / -0); // -Infinity ``` -Although a number often represents only its value, JavaScript provides {{jsxref("Operators", "binary (bitwise) operators")}}. +Although a number often represents only its value, JavaScript provides [bitwise operators](/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#bitwise_operators). > **Note:** Although bitwise operators _can_ be used to represent several Boolean values within a single number using [bit masking](https://en.wikipedia.org/wiki/Mask_%28computing%29), this is usually considered a bad practice. JavaScript offers other means to represent a set of Booleans (like an array of Booleans, or an object with Boolean values assigned to named properties). Bit masking also tends to make the code more difficult to read, understand, and maintain. diff --git a/files/en-us/web/javascript/reference/functions/index.md b/files/en-us/web/javascript/reference/functions/index.md index 9eef523cc2b29fb..c85dfd4444c5306 100644 --- a/files/en-us/web/javascript/reference/functions/index.md +++ b/files/en-us/web/javascript/reference/functions/index.md @@ -644,16 +644,16 @@ are no brackets "()" after the function name so the actual function is not calle ## See also -- {{jsxref("Statements/function", "function statement")}} -- {{jsxref("Operators/function", "function expression")}} -- {{jsxref("Statements/function*", "function* statement")}} -- {{jsxref("Operators/function*", "function* expression")}} +- [`function` declaration](/en-US/docs/Web/JavaScript/Reference/Statements/function) +- [`function` declaration](/en-US/docs/Web/JavaScript/Reference/Operators/function) +- [`function*` declaration](/en-US/docs/Web/JavaScript/Reference/Statements/function*) +- [`function*` expressions](/en-US/docs/Web/JavaScript/Reference/Operators/function*) - {{jsxref("Function")}} - {{jsxref("GeneratorFunction")}} -- {{jsxref("Functions/Arrow_functions", "Arrow functions")}} -- {{jsxref("Functions/Default_parameters", "Default parameters")}} -- {{jsxref("Functions/rest_parameters", "Rest parameters")}} -- {{jsxref("Functions/arguments", "Arguments object")}} -- {{jsxref("Functions/get", "getter")}} -- {{jsxref("Functions/set", "setter")}} -- {{jsxref("Functions/Method_definitions", "Method definitions")}} +- [Arrow functions](/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) +- [Rest parameters](/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) +- [Default parameters](/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters) +- [Method definitions](/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions) +- [getter](/en-US/docs/Web/JavaScript/Reference/Functions/get) +- [setter](/en-US/docs/Web/JavaScript/Reference/Functions/set) +- [The `arguments` object](/en-US/docs/Web/JavaScript/Reference/Functions/arguments) diff --git a/files/en-us/web/javascript/reference/global_objects/array/findlastindex/index.md b/files/en-us/web/javascript/reference/global_objects/array/findlastindex/index.md index d0a25d56c001bd8..9496e2169786d9d 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/findlastindex/index.md +++ b/files/en-us/web/javascript/reference/global_objects/array/findlastindex/index.md @@ -17,7 +17,7 @@ If no elements satisfy the testing function, -1 is returned. {{EmbedInteractiveExample("pages/js/array-findlastindex.html","shorter")}} -See also the {{jsxref("Array/findLast()", "findLast()")}} method, which returns the value of last element that satisfies the testing function (rather than its index). +See also the {{jsxref("Array/findLast", "findLast()")}} method, which returns the value of last element that satisfies the testing function (rather than its index). ## Syntax diff --git a/files/en-us/web/javascript/reference/global_objects/arraybuffer/index.md b/files/en-us/web/javascript/reference/global_objects/arraybuffer/index.md index f7cdc32e33cbb4d..282d4f28fe47268 100644 --- a/files/en-us/web/javascript/reference/global_objects/arraybuffer/index.md +++ b/files/en-us/web/javascript/reference/global_objects/arraybuffer/index.md @@ -32,7 +32,7 @@ The [`ArrayBuffer()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayB ## Static methods -- {{jsxref("ArrayBuffer.isView", "ArrayBuffer.isView(arg)")}} +- {{jsxref("ArrayBuffer.isView()")}} - : Returns `true` if `arg` is one of the ArrayBuffer views, such as [typed array objects](/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) or a {{jsxref("DataView")}}. Returns `false` otherwise. ## Instance properties diff --git a/files/en-us/web/javascript/reference/global_objects/asyncfunction/index.md b/files/en-us/web/javascript/reference/global_objects/asyncfunction/index.md index 04be24c093f1fc7..315e05818396131 100644 --- a/files/en-us/web/javascript/reference/global_objects/asyncfunction/index.md +++ b/files/en-us/web/javascript/reference/global_objects/asyncfunction/index.md @@ -49,10 +49,10 @@ AsyncFunction(arg0, arg1, /* … ,*/ argN, functionBody) ## Description -{{jsxref("Statements/async_function", "async function")}} objects created with the +[Async function](/en-US/docs/Web/JavaScript/Reference/Statements/async_function) objects created with the `AsyncFunction` constructor are parsed when the function is created. This is less efficient than declaring an async function with an -{{jsxref("Statements/async_function", "async function expression")}} and calling it +[`async function` expression](/en-US/docs/Web/JavaScript/Reference/Operators/async_function) and calling it within your code, because such functions are parsed with the rest of the code. All arguments passed to the function, except the last, are treated as the names of the identifiers of the diff --git a/files/en-us/web/javascript/reference/global_objects/asyncgenerator/index.md b/files/en-us/web/javascript/reference/global_objects/asyncgenerator/index.md index e396c3f278ebab2..5f56f70992a9582 100644 --- a/files/en-us/web/javascript/reference/global_objects/asyncgenerator/index.md +++ b/files/en-us/web/javascript/reference/global_objects/asyncgenerator/index.md @@ -94,7 +94,7 @@ main() - {{jsxref("Statements/function*", "function*", "", 1)}} - {{jsxref("Statements/async_function*", "async function*", "", 1)}} -- {{jsxref("Operators/function*", 'function* expression', "", 1)}} +- [`function*` expression](/en-US/docs/Web/JavaScript/Reference/Operators/function*) - {{jsxref("GeneratorFunction", "Generator Function", "", 1)}} - {{jsxref("AsyncGeneratorFunction", "Async Generator Function", "", 1)}} - [Iterators and generators](/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators) diff --git a/files/en-us/web/javascript/reference/global_objects/asyncgeneratorfunction/index.md b/files/en-us/web/javascript/reference/global_objects/asyncgeneratorfunction/index.md index 566fe7a59160219..0a9aade2367e268 100644 --- a/files/en-us/web/javascript/reference/global_objects/asyncgeneratorfunction/index.md +++ b/files/en-us/web/javascript/reference/global_objects/asyncgeneratorfunction/index.md @@ -49,7 +49,7 @@ AsyncGeneratorFunction(arg0, arg1, /* … ,*/ argN, functionBody) ## Description -Async generator function objects created with the `AsyncGeneratorFunction` constructor are parsed when the function is created. This is less efficient than declaring a generator function with an {{jsxref("Operators/async_function*", "async function* expression")}} and calling it within your code, because such functions are parsed with the rest of the code. +Async generator function objects created with the `AsyncGeneratorFunction` constructor are parsed when the function is created. This is less efficient than declaring a generator function with an [`async function*` expression](/en-US/docs/Web/JavaScript/Reference/Statements/async_function*) and calling it within your code, because such functions are parsed with the rest of the code. All arguments passed to the function, except the last, are treated as the names of the identifiers of the parameters in the function to be created, in the order in which they are passed. @@ -85,7 +85,7 @@ asyncGen.next().then((res) => console.log(res.value)); // 20 - {{jsxref("Statements/function*", "function*")}} - {{jsxref("Statements/async_function*", "async function*")}} -- {{jsxref("Operators/function*", 'function* expression', "", 1)}} +- [`function*` expression](/en-US/docs/Web/JavaScript/Reference/Operators/function*) - {{jsxref("Global_Objects/AsyncGenerator", "AsyncGenerator")}} - {{jsxref("Global_Objects/Generator", "Generator")}} - {{jsxref("Global_Objects/GeneratorFunction", "GeneratorFunction")}} diff --git a/files/en-us/web/javascript/reference/global_objects/generator/index.md b/files/en-us/web/javascript/reference/global_objects/generator/index.md index b0ab51039ac15e7..7aaaefa80e1bf2e 100644 --- a/files/en-us/web/javascript/reference/global_objects/generator/index.md +++ b/files/en-us/web/javascript/reference/global_objects/generator/index.md @@ -78,6 +78,6 @@ console.log(generator.next().value); // 2 ## See also - {{JSxRef("Statements/function*", "function*")}} -- {{JSxRef("Operators/function*", 'function* expression', "", 1)}} +- [`function*` expression](/en-US/docs/Web/JavaScript/Reference/Operators/function*) - {{JSxRef("GeneratorFunction")}} - [The Iterator protocol](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) diff --git a/files/en-us/web/javascript/reference/global_objects/generatorfunction/index.md b/files/en-us/web/javascript/reference/global_objects/generatorfunction/index.md index 329f5526cf2de20..23699f1358eb391 100644 --- a/files/en-us/web/javascript/reference/global_objects/generatorfunction/index.md +++ b/files/en-us/web/javascript/reference/global_objects/generatorfunction/index.md @@ -50,7 +50,7 @@ GeneratorFunction(arg0, arg1, /* … ,*/ argN, functionBody) {{jsxref("Statements/function*", "Generator function", "", "1")}} objects created with a constructor are parsed when the function is created. That is less efficient than declaring a generator function with a -{{jsxref("Statements/function*", "function* expression")}} and calling it within your +[`function*` expression](/en-US/docs/Web/JavaScript/Reference/Statements/function*) and calling it within your code, because such functions are parsed with the rest of the code. All arguments passed to the function, except the last, are treated as the names of the identifiers of the diff --git a/files/en-us/web/javascript/reference/global_objects/json/index.md b/files/en-us/web/javascript/reference/global_objects/json/index.md index 41a01dac133f2f4..2c7a6c514fade1c 100644 --- a/files/en-us/web/javascript/reference/global_objects/json/index.md +++ b/files/en-us/web/javascript/reference/global_objects/json/index.md @@ -113,15 +113,14 @@ whitespace characters. ## Static methods -- {{jsxref("JSON.parse()", "JSON.parse(text[, reviver])")}} +- {{jsxref("JSON.parse()")}} - : Parse the string `text` as JSON, optionally transform the produced value and its properties, and return the value. Any violations of the JSON syntax, including those pertaining to the differences between JavaScript and JSON, cause a {{jsxref("SyntaxError")}} to be thrown. The `reviver` option allows for interpreting what the `replacer` has used to stand in for other datatypes. -- {{jsxref("JSON.stringify()", "JSON.stringify(value[, - replacer[, space]])")}} +- {{jsxref("JSON.stringify()")}} - : Return a JSON string corresponding to the specified value, optionally including only certain properties or replacing property values in a user-defined manner. By default, all instances of {{jsxref("undefined")}} are replaced with [`null`](/en-US/docs/Web/JavaScript/Reference/Operators/null), and diff --git a/files/en-us/web/javascript/reference/global_objects/map/@@iterator/index.md b/files/en-us/web/javascript/reference/global_objects/map/@@iterator/index.md index 9c112ea8346c2c6..83abbe49bbdec79 100644 --- a/files/en-us/web/javascript/reference/global_objects/map/@@iterator/index.md +++ b/files/en-us/web/javascript/reference/global_objects/map/@@iterator/index.md @@ -13,9 +13,7 @@ browser-compat: javascript.builtins.Map.@@iterator --- {{JSRef}} -

The initial value of the @@iterator -property is the same function object as the initial value of the -{{jsxref("Map.prototype.entries()", "entries")}} method.

+The initial value of the **`@@iterator`** property is the same function object as the initial value of the {{jsxref("Map.prototype.entries()")}} method. {{EmbedInteractiveExample("pages/js/map-prototype-@@iterator.html")}} diff --git a/files/en-us/web/javascript/reference/global_objects/math/index.md b/files/en-us/web/javascript/reference/global_objects/math/index.md index abbd671260e4f3a..fab7904be536e30 100644 --- a/files/en-us/web/javascript/reference/global_objects/math/index.md +++ b/files/en-us/web/javascript/reference/global_objects/math/index.md @@ -43,75 +43,75 @@ Unlike many other global objects, `Math` is not a constructor. All properties an ## Static methods -- {{jsxref("Global_Objects/Math/abs", "Math.abs(x)")}} +- {{jsxref("Math.abs()")}} - : Returns the absolute value of `x`. -- {{jsxref("Global_Objects/Math/acos", "Math.acos(x)")}} +- {{jsxref("Math.acos()")}} - : Returns the arccosine of `x`. -- {{jsxref("Global_Objects/Math/acosh", "Math.acosh(x)")}} +- {{jsxref("Math.acosh()")}} - : Returns the hyperbolic arccosine of `x`. -- {{jsxref("Global_Objects/Math/asin", "Math.asin(x)")}} +- {{jsxref("Math.asin()")}} - : Returns the arcsine of `x`. -- {{jsxref("Global_Objects/Math/asinh", "Math.asinh(x)")}} +- {{jsxref("Math.asinh()")}} - : Returns the hyperbolic arcsine of a number. -- {{jsxref("Global_Objects/Math/atan", "Math.atan(x)")}} +- {{jsxref("Math.atan()")}} - : Returns the arctangent of `x`. -- {{jsxref("Global_Objects/Math/atanh", "Math.atanh(x)")}} +- {{jsxref("Math.atanh()")}} - : Returns the hyperbolic arctangent of `x`. -- {{jsxref("Global_Objects/Math/atan2", "Math.atan2(y, x)")}} +- {{jsxref("Math.atan2()")}} - : Returns the arctangent of the quotient of its arguments. -- {{jsxref("Global_Objects/Math/cbrt", "Math.cbrt(x)")}} +- {{jsxref("Math.cbrt()")}} - : Returns the cube root of `x`. -- {{jsxref("Global_Objects/Math/ceil", "Math.ceil(x)")}} +- {{jsxref("Math.ceil()")}} - : Returns the smallest integer greater than or equal to `x`. -- {{jsxref("Global_Objects/Math/clz32", "Math.clz32(x)")}} +- {{jsxref("Math.clz32()")}} - : Returns the number of leading zero bits of the 32-bit integer `x`. -- {{jsxref("Global_Objects/Math/cos", "Math.cos(x)")}} +- {{jsxref("Math.cos()")}} - : Returns the cosine of `x`. -- {{jsxref("Global_Objects/Math/cosh", "Math.cosh(x)")}} +- {{jsxref("Math.cosh()")}} - : Returns the hyperbolic cosine of `x`. -- {{jsxref("Global_Objects/Math/exp", "Math.exp(x)")}} +- {{jsxref("Math.exp()")}} - : Returns ex, where x is the argument, and e is Euler's constant (`2.718`…, the base of the natural logarithm). -- {{jsxref("Global_Objects/Math/expm1", "Math.expm1(x)")}} +- {{jsxref("Math.expm1()")}} - : Returns subtracting `1` from `exp(x)`. -- {{jsxref("Global_Objects/Math/floor", "Math.floor(x)")}} +- {{jsxref("Math.floor()")}} - : Returns the largest integer less than or equal to `x`. -- {{jsxref("Global_Objects/Math/fround", "Math.fround(x)")}} +- {{jsxref("Math.fround()")}} - : Returns the nearest [single precision](https://en.wikipedia.org/wiki/Single-precision_floating-point_format) float representation of `x`. -- {{jsxref("Global_Objects/Math/hypot", "Math.hypot([x[, y[, …]]])")}} +- {{jsxref("Math.hypot()")}} - : Returns the square root of the sum of squares of its arguments. -- {{jsxref("Global_Objects/Math/imul", "Math.imul(x, y)")}} +- {{jsxref("Math.imul()")}} - : Returns the result of the 32-bit integer multiplication of `x` and `y`. -- {{jsxref("Global_Objects/Math/log", "Math.log(x)")}} +- {{jsxref("Math.log()")}} - : Returns the natural logarithm (㏒e; also, ㏑) of `x`. -- {{jsxref("Global_Objects/Math/log1p", "Math.log1p(x)")}} +- {{jsxref("Math.log1p()")}} - : Returns the natural logarithm (㏒e; also ㏑) of `1 + x` for the number `x`. -- {{jsxref("Global_Objects/Math/log10", "Math.log10(x)")}} +- {{jsxref("Math.log10()")}} - : Returns the base-10 logarithm of `x`. -- {{jsxref("Global_Objects/Math/log2", "Math.log2(x)")}} +- {{jsxref("Math.log2()")}} - : Returns the base-2 logarithm of `x`. -- {{jsxref("Global_Objects/Math/max", "Math.max([x[, y[, …]]])")}} +- {{jsxref("Math.max()")}} - : Returns the largest of zero or more numbers. -- {{jsxref("Global_Objects/Math/min", "Math.min([x[, y[, …]]])")}} +- {{jsxref("Math.min()")}} - : Returns the smallest of zero or more numbers. -- {{jsxref("Global_Objects/Math/pow", "Math.pow(x, y)")}} +- {{jsxref("Math.pow()")}} - : Returns base `x` to the exponent power `y` (that is, `x`y). -- {{jsxref("Global_Objects/Math/random", "Math.random()")}} +- {{jsxref("Math.random()")}} - : Returns a pseudo-random number between `0` and `1`. -- {{jsxref("Global_Objects/Math/round", "Math.round(x)")}} +- {{jsxref("Math.round()")}} - : Returns the value of the number `x` rounded to the nearest integer. -- {{jsxref("Global_Objects/Math/sign", "Math.sign(x)")}} +- {{jsxref("Math.sign()")}} - : Returns the sign of the `x`, indicating whether `x` is positive, negative, or zero. -- {{jsxref("Global_Objects/Math/sin", "Math.sin(x)")}} +- {{jsxref("Math.sin()")}} - : Returns the sine of `x`. -- {{jsxref("Global_Objects/Math/sinh", "Math.sinh(x)")}} +- {{jsxref("Math.sinh()")}} - : Returns the hyperbolic sine of `x`. -- {{jsxref("Global_Objects/Math/sqrt", "Math.sqrt(x)")}} +- {{jsxref("Math.sqrt()")}} - : Returns the positive square root of `x`. -- {{jsxref("Global_Objects/Math/tan", "Math.tan(x)")}} +- {{jsxref("Math.tan()")}} - : Returns the tangent of `x`. -- {{jsxref("Global_Objects/Math/tanh", "Math.tanh(x)")}} +- {{jsxref("Math.tanh()")}} - : Returns the hyperbolic tangent of `x`. -- {{jsxref("Global_Objects/Math/trunc", "Math.trunc(x)")}} +- {{jsxref("Math.trunc()")}} - : Returns the integer portion of `x`, removing any fractional digits. ## Examples diff --git a/files/en-us/web/javascript/reference/global_objects/number/index.md b/files/en-us/web/javascript/reference/global_objects/number/index.md index 0ceade460581eeb..3fc75c65ec2d4b2 100644 --- a/files/en-us/web/javascript/reference/global_objects/number/index.md +++ b/files/en-us/web/javascript/reference/global_objects/number/index.md @@ -83,22 +83,22 @@ When `Number` is called as a constructor (with `new`), it creates a {{jsxref("Nu - : Determine whether the passed value is an integer. - {{jsxref("Number.isSafeInteger()")}} - : Determine whether the passed value is a safe integer (number between -(253 - 1) and 253 - 1). -- {{jsxref("Number.parseFloat()", "Number.parseFloat(string)")}} +- {{jsxref("Number.parseFloat()")}} - : This is the same as the global {{jsxref("parseFloat", "parseFloat()")}} function. -- {{jsxref("Number.parseInt()", "Number.parseInt(string, [radix])")}} +- {{jsxref("Number.parseInt()")}} - : This is the same as the global {{jsxref("parseInt", "parseInt()")}} function. ## Instance methods -- {{jsxref("Number.prototype.toExponential()" ,"Number.prototype.toExponential(fractionDigits)")}} +- {{jsxref("Number.prototype.toExponential()")}} - : Returns a string representing the number in exponential notation. -- {{jsxref("Number.prototype.toFixed()", "Number.prototype.toFixed(digits)")}} +- {{jsxref("Number.prototype.toFixed()")}} - : Returns a string representing the number in fixed-point notation. -- {{jsxref("Number.prototype.toLocaleString()", "Number.prototype.toLocaleString([locales [, options]])")}} +- {{jsxref("Number.prototype.toLocaleString()")}} - : Returns a string with a language sensitive representation of this number. Overrides the {{jsxref("Object.prototype.toLocaleString()")}} method. -- {{jsxref("Number.prototype.toPrecision()", "Number.prototype.toPrecision(precision)")}} +- {{jsxref("Number.prototype.toPrecision()")}} - : Returns a string representing the number to a specified precision in fixed-point or exponential notation. -- {{jsxref("Number.prototype.toString()", "Number.prototype.toString([radix])")}} +- {{jsxref("Number.prototype.toString()")}} - : Returns a string representing the specified object in the specified _radix_ ("base"). Overrides the {{jsxref("Object.prototype.toString()")}} method. - {{jsxref("Number.prototype.valueOf()")}} - : Returns the primitive value of the specified object. Overrides the {{jsxref("Object.prototype.valueOf()")}} method. diff --git a/files/en-us/web/javascript/reference/global_objects/object/entries/index.md b/files/en-us/web/javascript/reference/global_objects/object/entries/index.md index 90f27a5ceb6c136..121cc3575e87083 100644 --- a/files/en-us/web/javascript/reference/global_objects/object/entries/index.md +++ b/files/en-us/web/javascript/reference/global_objects/object/entries/index.md @@ -87,9 +87,9 @@ Object.entries(obj).forEach(([key, value]) => { }); ``` -### Converting an `Object` to a `Map` +### Converting an Object to a Map -The {{jsxref("Map", "new Map()")}} constructor accepts an iterable of +The {{jsxref("Map/Map", "Map()")}} constructor accepts an iterable of `entries`. With `Object.entries`, you can easily convert from {{jsxref("Object")}} to {{jsxref("Map")}}: @@ -99,7 +99,7 @@ const map = new Map(Object.entries(obj)); console.log(map); // Map(2) {"foo" => "bar", "baz" => 42} ``` -### Iterating through an `Object` +### Iterating through an Object Using [Array Destructuring](/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#array_destructuring), you can iterate through objects easily. diff --git a/files/en-us/web/javascript/reference/global_objects/reflect/index.md b/files/en-us/web/javascript/reference/global_objects/reflect/index.md index 2a6a7852d8e84ed..e7aad8c5aaf5225 100644 --- a/files/en-us/web/javascript/reference/global_objects/reflect/index.md +++ b/files/en-us/web/javascript/reference/global_objects/reflect/index.md @@ -23,31 +23,31 @@ Some of these methods are also the same as corresponding methods on {{jsxref("Ob ## Static methods -- {{jsxref("Reflect.apply()", "Reflect.apply(target, thisArgument, argumentsList)")}} +- {{jsxref("Reflect.apply()")}} - : Calls a `target` function with arguments as specified by the `argumentsList` parameter. See also {{jsxref("Function.prototype.apply()")}}. -- {{jsxref("Reflect.construct()", "Reflect.construct(target, argumentsList[, newTarget])")}} +- {{jsxref("Reflect.construct()")}} - : The [`new` operator](/en-US/docs/Web/JavaScript/Reference/Operators/new) as a function. Equivalent to calling `new target(...argumentsList)`. Also provides the option to specify a different prototype. -- {{jsxref("Reflect.defineProperty()", "Reflect.defineProperty(target, propertyKey, attributes)")}} +- {{jsxref("Reflect.defineProperty()")}} - : Similar to {{jsxref("Object.defineProperty()")}}. Returns a boolean that is `true` if the property was successfully defined. -- {{jsxref("Reflect.deleteProperty()", "Reflect.deleteProperty(target, propertyKey)")}} +- {{jsxref("Reflect.deleteProperty()")}} - : The [`delete` operator](/en-US/docs/Web/JavaScript/Reference/Operators/delete) as a function. Equivalent to calling `delete target[propertyKey]`. -- {{jsxref("Reflect.get()", "Reflect.get(target, propertyKey[, receiver])")}} +- {{jsxref("Reflect.get()")}} - : Returns the value of the property. Works like getting a property from an object (`target[propertyKey]`) as a function. -- {{jsxref("Reflect.getOwnPropertyDescriptor()", "Reflect.getOwnPropertyDescriptor(target, propertyKey)")}} +- {{jsxref("Reflect.getOwnPropertyDescriptor()")}} - : Similar to {{jsxref("Object.getOwnPropertyDescriptor()")}}. Returns a property descriptor of the given property if it exists on the object, {{jsxref("undefined")}} otherwise. -- {{jsxref("Reflect.getPrototypeOf()", "Reflect.getPrototypeOf(target)")}} +- {{jsxref("Reflect.getPrototypeOf()")}} - : Same as {{jsxref("Object.getPrototypeOf()")}}. -- {{jsxref("Reflect.has()", "Reflect.has(target, propertyKey)")}} +- {{jsxref("Reflect.has()")}} - : Returns a boolean indicating whether the target has the property. Either as own or inherited. Works like the [`in` operator](/en-US/docs/Web/JavaScript/Reference/Operators/in) as a function. -- {{jsxref("Reflect.isExtensible()", "Reflect.isExtensible(target)")}} +- {{jsxref("Reflect.isExtensible()")}} - : Same as {{jsxref("Object.isExtensible()")}}. Returns a boolean that is `true` if the target is extensible. -- {{jsxref("Reflect.ownKeys()", "Reflect.ownKeys(target)")}} +- {{jsxref("Reflect.ownKeys()")}} - : Returns an array of the target object's own (not inherited) property keys. -- {{jsxref("Reflect.preventExtensions()", "Reflect.preventExtensions(target)")}} +- {{jsxref("Reflect.preventExtensions()")}} - : Similar to {{jsxref("Object.preventExtensions()")}}. Returns a boolean that is `true` if the update was successful. -- {{jsxref("Reflect.set()", "Reflect.set(target, propertyKey, value[, receiver])")}} +- {{jsxref("Reflect.set()")}} - : A function that assigns values to properties. Returns a boolean that is `true` if the update was successful. -- {{jsxref("Reflect.setPrototypeOf()", "Reflect.setPrototypeOf(target, prototype)")}} +- {{jsxref("Reflect.setPrototypeOf()")}} - : A function that sets the prototype of an object. Returns a boolean that is `true` if the update was successful. ## Examples diff --git a/files/en-us/web/javascript/reference/global_objects/string/index.md b/files/en-us/web/javascript/reference/global_objects/string/index.md index 0a2d602aea64ed6..3deed9ed88b8fd1 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/index.md +++ b/files/en-us/web/javascript/reference/global_objects/string/index.md @@ -255,11 +255,9 @@ You must be careful which level of characters you are iterating on. For example, ## Static methods -- {{jsxref("String.fromCharCode()", "String.fromCharCode(num1 [, ...[, - numN]])")}} +- {{jsxref("String.fromCharCode()")}} - : Returns a string created by using the specified sequence of Unicode values. -- {{jsxref("String.fromCodePoint()", "String.fromCodePoint(num1 [, ...[, - numN)")}} +- {{jsxref("String.fromCodePoint()")}} - : Returns a string created by using the specified sequence of code points. - {{jsxref("String.raw()")}} - : Returns a string created from a raw template string. @@ -271,95 +269,74 @@ You must be careful which level of characters you are iterating on. For example, ## Instance methods -- {{jsxref("String.prototype.at()", "String.prototype.at(index)")}} +- {{jsxref("String.prototype.at()")}} - : Returns the character (exactly one UTF-16 code unit) at the specified `index`. Accepts negative integers, which count back from the last string character. -- {{jsxref("String.prototype.charAt()", "String.prototype.charAt(index)")}} +- {{jsxref("String.prototype.charAt()")}} - : Returns the character (exactly one UTF-16 code unit) at the specified `index`. -- {{jsxref("String.prototype.charCodeAt()", - "String.prototype.charCodeAt(index)")}} +- {{jsxref("String.prototype.charCodeAt()")}} - : Returns a number that is the UTF-16 code unit value at the given `index`. -- {{jsxref("String.prototype.codePointAt()", - "String.prototype.codePointAt(pos)")}} +- {{jsxref("String.prototype.codePointAt()")}} - : Returns a nonnegative integer Number that is the code point value of the UTF-16 encoded code point starting at the specified `pos`. -- {{jsxref("String.prototype.concat()", "String.prototype.concat(str [, - ...strN ])")}} +- {{jsxref("String.prototype.concat()")}} - : Combines the text of two (or more) strings and returns a new string. -- {{jsxref("String.prototype.includes()", - "String.prototype.includes(searchString [, position])")}} +- {{jsxref("String.prototype.includes()")}} - : Determines whether the calling string contains `searchString`. -- {{jsxref("String.prototype.endsWith()", - "String.prototype.endsWith(searchString [, length])")}} +- {{jsxref("String.prototype.endsWith()")}} - : Determines whether a string ends with the characters of the string `searchString`. -- {{jsxref("String.prototype.indexOf()", - "String.prototype.indexOf(searchValue [, fromIndex])")}} +- {{jsxref("String.prototype.indexOf()")}} - : Returns the index within the calling {{jsxref("String")}} object of the first occurrence of `searchValue`, or `-1` if not found. -- {{jsxref("String.prototype.lastIndexOf()", - "String.prototype.lastIndexOf(searchValue [, fromIndex])")}} +- {{jsxref("String.prototype.lastIndexOf()")}} - : Returns the index within the calling {{jsxref("String")}} object of the last occurrence of `searchValue`, or `-1` if not found. -- {{jsxref("String.prototype.localeCompare()", - "String.prototype.localeCompare(compareString [, locales [, - options]])")}} +- {{jsxref("String.prototype.localeCompare()")}} - : Returns a number indicating whether the reference string `compareString` comes before, after, or is equivalent to the given string in sort order. -- {{jsxref("String.prototype.match()", "String.prototype.match(regexp)")}} +- {{jsxref("String.prototype.match()")}} - : Used to match regular expression `regexp` against a string. -- {{jsxref("String.prototype.matchAll()", - "String.prototype.matchAll(regexp)")}} +- {{jsxref("String.prototype.matchAll()")}} - : Returns an iterator of all `regexp`'s matches. -- {{jsxref("String.prototype.normalize()", - "String.prototype.normalize([form])")}} +- {{jsxref("String.prototype.normalize()")}} - : Returns the Unicode Normalization Form of the calling string value. -- {{jsxref("String.prototype.padEnd()", - "String.prototype.padEnd(targetLength [, padString])")}} +- {{jsxref("String.prototype.padEnd()")}} - : Pads the current string from the end with a given string and returns a new string of the length `targetLength`. -- {{jsxref("String.prototype.padStart()", - "String.prototype.padStart(targetLength [, padString])")}} +- {{jsxref("String.prototype.padStart()")}} - : Pads the current string from the start with a given string and returns a new string of the length `targetLength`. -- {{jsxref("String.prototype.repeat()", "String.prototype.repeat(count)")}} +- {{jsxref("String.prototype.repeat()")}} - : Returns a string consisting of the elements of the object repeated `count` times. -- {{jsxref("String.prototype.replace()" , - "String.prototype.replace(searchFor, replaceWith)")}} +- {{jsxref("String.prototype.replace()")}} - : Used to replace occurrences of `searchFor` using `replaceWith`. `searchFor` may be a string or Regular Expression, and `replaceWith` may be a string or function. -- {{jsxref("String.prototype.replaceAll()" , - "String.prototype.replaceAll(searchFor, replaceWith)")}} +- {{jsxref("String.prototype.replaceAll()")}} - : Used to replace all occurrences of `searchFor` using `replaceWith`. `searchFor` may be a string or Regular Expression, and `replaceWith` may be a string or function. -- {{jsxref("String.prototype.search()", - "String.prototype.search(regexp)")}} +- {{jsxref("String.prototype.search()")}} - : Search for a match between a regular expression `regexp` and the calling string. -- {{jsxref("String.prototype.slice()", "String.prototype.slice(beginIndex[, - endIndex])")}} +- {{jsxref("String.prototype.slice()")}} - : Extracts a section of a string and returns a new string. -- {{jsxref("String.prototype.split()", "String.prototype.split([sep [, - limit] ])")}} +- {{jsxref("String.prototype.split()")}} - : Returns an array of strings populated by splitting the calling string at occurrences of the substring `sep`. -- {{jsxref("String.prototype.startsWith()", - "String.prototype.startsWith(searchString [, length])")}} +- {{jsxref("String.prototype.startsWith()")}} - : Determines whether the calling string begins with the characters of string `searchString`. -- {{jsxref("String.prototype.substring()", - "String.prototype.substring(indexStart [, indexEnd])")}} +- {{jsxref("String.prototype.substring()")}} - : Returns a new string containing characters of the calling string from (or between) the specified index (or indices). -- {{jsxref("String.prototype.toLocaleLowerCase()", - "String.prototype.toLocaleLowerCase( [locale, ...locales])")}} +- {{jsxref("String.prototype.toLocaleLowerCase()")}} - : The characters within a string are converted to lowercase while respecting the current locale. diff --git a/files/en-us/web/javascript/reference/global_objects/string/matchall/index.md b/files/en-us/web/javascript/reference/global_objects/string/matchall/index.md index ff3a6d6795a56d6..7069ea0bd9ad1d1 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/matchall/index.md +++ b/files/en-us/web/javascript/reference/global_objects/string/matchall/index.md @@ -64,7 +64,7 @@ while ((match = regexp.exec(str)) !== null) { } ``` -With `matchAll()` available, you can avoid the {{jsxref("Statements/while", "while")}} loop and `exec` with `g`. Instead, you get an iterator to use with the more convenient {{jsxref("Statements/for...of", "for...of")}}, {{jsxref("Operators/Spread_syntax", "array spread")}}, or {{jsxref("Array.from()")}} constructs: +With `matchAll()` available, you can avoid the {{jsxref("Statements/while", "while")}} loop and `exec` with `g`. Instead, you get an iterator to use with the more convenient {{jsxref("Statements/for...of", "for...of")}}, [array spreading](/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax), or {{jsxref("Array.from()")}} constructs: ```js const regexp = /foo[a-z]*/g; diff --git a/files/en-us/web/javascript/reference/global_objects/symbol/unscopables/index.md b/files/en-us/web/javascript/reference/global_objects/symbol/unscopables/index.md index bae2f374f058e57..954594ad1f9020a 100644 --- a/files/en-us/web/javascript/reference/global_objects/symbol/unscopables/index.md +++ b/files/en-us/web/javascript/reference/global_objects/symbol/unscopables/index.md @@ -19,7 +19,7 @@ The **`Symbol.unscopables`** well-known symbol is used to specify an object valu The `@@unscopables` property (accessed via `Symbol.unscopables`) can be defined on any object to exclude property names from being exposed as lexical variables in [`with`](/en-US/docs/Web/JavaScript/Reference/Statements/with) environment bindings. Note that when using [strict mode](/en-US/docs/Web/JavaScript/Reference/Strict_mode), `with` statements are not available, and this symbol is likely not needed. -Setting a property of the `@@unscopables` object to `true` (or any [truthy](/en-US/docs/Glossary/Truthy) value) will make the corresponding property of the `with` scope object _unscopable_ and therefore won't be introduced to the `with` body scope. Setting a property to `false` (or any [falsy](/en-US/docs/Glossary/falsy) value) will make it _scopable_ and thus appear as lexical scope variables. +Setting a property of the `@@unscopables` object to `true` (or any [truthy](/en-US/docs/Glossary/Truthy) value) will make the corresponding property of the `with` scope object _unscopable_ and therefore won't be introduced to the `with` body scope. Setting a property to `false` (or any [falsy](/en-US/docs/Glossary/Falsy) value) will make it _scopable_ and thus appear as lexical scope variables. When deciding whether `x` is unscopable, the entire prototype chain of the `@@unscopables` property is looked up for a property called `x`. This means if you declared `@@unscopables` as a plain object, `Object.prototype` properties like [`toString`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString) would become unscopable as well, which may cause backward incompatibility for legacy code assuming those properties are normally scoped (see [an example below](#avoid_using_a_non-null-prototype_object_as_unscopables)). You are advised to make your custom `@@unscopables` property have `null` as its prototype, like [`Array.prototype[@@unscopables]`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/@@unscopables) does. diff --git a/files/en-us/web/javascript/reference/index.md b/files/en-us/web/javascript/reference/index.md index e039a497cb2ad88..09bde5301e3da7c 100644 --- a/files/en-us/web/javascript/reference/index.md +++ b/files/en-us/web/javascript/reference/index.md @@ -215,7 +215,7 @@ This part of the JavaScript section on MDN serves as a repository of facts about ### Left-hand-side expressions - {{JSxRef("Operators/Property_accessors", "Property accessors", "", 1)}} -- {{JSxRef("Operators/Optional_chaining", "?. (Optional chaining)", "", 1)}} +- [`?.` (Optional chaining)](/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) - {{JSxRef("Operators/new", "new")}} - {{JSxRef("Operators/new%2Etarget", "new.target")}} - {{JSxRef("Operators/import%2Emeta", "import.meta")}} @@ -304,8 +304,8 @@ This part of the JavaScript section on MDN serves as a repository of facts about - {{JSxRef("Operators/Logical_AND_assignment", "&&=")}} - {{JSxRef("Operators/Logical_OR_assignment", "||=")}} - {{JSxRef("Operators/Logical_nullish_assignment", "??=")}} -- {{JSxRef("Operators/Destructuring_assignment", "[a, b] = [1, 2]")}} -- {{JSxRef("Operators/Destructuring_assignment", "{a, b} = {a:1, b:2}")}} +- {{JSxRef("Operators/Destructuring_assignment", "[a, b] = arr")}} +- {{JSxRef("Operators/Destructuring_assignment", "{ a, b } = obj")}} ### Comma operators diff --git a/files/en-us/web/javascript/reference/iteration_protocols/index.md b/files/en-us/web/javascript/reference/iteration_protocols/index.md index 38774b302338646..ffd20c34368f79b 100644 --- a/files/en-us/web/javascript/reference/iteration_protocols/index.md +++ b/files/en-us/web/javascript/reference/iteration_protocols/index.md @@ -145,15 +145,15 @@ Array Iterator {} There are many APIs that accept iterables. Some examples include: -- {{jsxref("Map", "new Map([iterable])")}} -- {{jsxref("WeakMap", "new WeakMap([iterable])")}} -- {{jsxref("Set", "new Set([iterable])")}} -- {{jsxref("WeakSet", "new WeakSet([iterable])")}} -- {{jsxref("Promise.all()", "Promise.all(iterable)")}} -- {{jsxref("Promise.allSettled()", "Promise.allSettled(iterable)")}} -- {{jsxref("Promise.race()", "Promise.race(iterable)")}} -- {{jsxref("Promise.any()", "Promise.any(iterable)")}} -- {{jsxref("Array.from()", "Array.from(iterable)")}} +- {{jsxref("Map/Map", "Map()")}} +- {{jsxref("WeakMap/WeakMap", "WeakMap()")}} +- {{jsxref("Set/Set", "Set()")}} +- {{jsxref("WeakSet/WeakSet", "WeakSet()")}} +- {{jsxref("Promise.all()")}} +- {{jsxref("Promise.allSettled()")}} +- {{jsxref("Promise.race()")}} +- {{jsxref("Promise.any()")}} +- {{jsxref("Array.from()")}} ```js const myObj = {}; @@ -431,5 +431,5 @@ console.log(`${someString}`); // "hi" ## See also -- {{jsxref("Statements/function*", "the function* documentation", "", 1)}} +- [`function*` declaration](/en-US/docs/Web/JavaScript/Reference/Statements/function*) - [Iteration in the ECMAScript specification](https://tc39.es/ecma262/#sec-iteration) diff --git a/files/en-us/web/javascript/reference/operators/await/index.md b/files/en-us/web/javascript/reference/operators/await/index.md index 8458d471291c83a..60656ed155a2214 100644 --- a/files/en-us/web/javascript/reference/operators/await/index.md +++ b/files/en-us/web/javascript/reference/operators/await/index.md @@ -11,7 +11,7 @@ browser-compat: javascript.operators.await --- {{jsSidebar("Operators")}} -The `await` operator is used to wait for a {{jsxref("Promise")}}. It can only be used inside an {{jsxref("Statements/async_function", "async function")}} within regular JavaScript code; however it can be used on its own with [JavaScript modules.](/en-US/docs/Web/JavaScript/Guide/Modules) +The `await` operator is used to wait for a {{jsxref("Promise")}}. It can only be used inside an [async function](/en-US/docs/Web/JavaScript/Reference/Statements/async_function) or a [JavaScript module](/en-US/docs/Web/JavaScript/Guide/Modules). ## Syntax @@ -72,7 +72,7 @@ f1(); ### Thenable objects -{{jsxref("Global_Objects/Promise/then", "Thenable objects")}} will be fulfilled just +[Thenable objects](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#thenables) will be fulfilled just the same. ```js @@ -153,6 +153,6 @@ export default await colors; ## See also - {{jsxref("Statements/async_function", "async function")}} -- {{jsxref("Operators/async_function", "async function expression")}} +- [`async function` expression](/en-US/docs/Web/JavaScript/Reference/Operators/async_function) - {{jsxref("AsyncFunction")}} object - [Top level await](https://v8.dev/features/top-level-await) on v8.dev diff --git a/files/en-us/web/javascript/reference/operators/delete/index.md b/files/en-us/web/javascript/reference/operators/delete/index.md index ce0ad856be92225..d1520f3923f35c6 100644 --- a/files/en-us/web/javascript/reference/operators/delete/index.md +++ b/files/en-us/web/javascript/reference/operators/delete/index.md @@ -290,9 +290,9 @@ console.log(3 in trees); // true ``` If instead, you want to remove an array element by changing the contents of the array, -use the {{jsxref("Array/splice()", "splice()")}} method. In the following example, +use the {{jsxref("Array/splice", "splice()")}} method. In the following example, `trees[3]` is removed from the array completely using -{{jsxref("Array/splice()", "splice()")}}: +{{jsxref("Array/splice", "splice()")}}: ```js const trees = ['redwood', 'bay', 'cedar', 'oak', 'maple']; diff --git a/files/en-us/web/javascript/reference/operators/function/index.md b/files/en-us/web/javascript/reference/operators/function/index.md index 7237bf2b20970b4..531343be26789b8 100644 --- a/files/en-us/web/javascript/reference/operators/function/index.md +++ b/files/en-us/web/javascript/reference/operators/function/index.md @@ -103,7 +103,7 @@ The variable to which the function expression is assigned will have a `name` pro The name doesn't change if it's assigned to a different variable. If function name is omitted, it will be the variable name (implicit name). If function name is present, it will be the function name (explicit name). -This also applies to {{jsxref("Functions/Arrow_functions", "arrow functions")}} (arrows don't have a name so you can only give the variable an implicit name). +This also applies to [arrow functions](/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) (arrows don't have a name so you can only give the variable an implicit name). ```js const foo = function () {}; diff --git a/files/en-us/web/javascript/reference/operators/index.md b/files/en-us/web/javascript/reference/operators/index.md index 457011ea76e384d..fbbb5cb9961c30b 100644 --- a/files/en-us/web/javascript/reference/operators/index.md +++ b/files/en-us/web/javascript/reference/operators/index.md @@ -226,8 +226,7 @@ An assignment operator assigns a value to its left operand based on the value of - : Logical OR assignment. - {{JSxRef("Operators/Logical_nullish_assignment", "??=")}} - : Logical nullish assignment. -- {{JSxRef("Operators/Destructuring_assignment", "[a, b] = [1, 2]")}} - {{JSxRef("Operators/Destructuring_assignment", "{a, b} = {a:1, b:2}")}} +- [`[a, b] = arr`, `{ a, b } = obj`](/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) - : Destructuring assignment allows you to assign the properties of an array or object to variables using syntax that looks similar to array or object literals. ### Comma operator diff --git a/files/en-us/web/javascript/reference/operators/null/index.md b/files/en-us/web/javascript/reference/operators/null/index.md index 4a8cc6b4885a0f4..b2cf7af0a31e337 100644 --- a/files/en-us/web/javascript/reference/operators/null/index.md +++ b/files/en-us/web/javascript/reference/operators/null/index.md @@ -73,4 +73,4 @@ isNaN(1 + undefined) // true - {{jsxref("undefined")}} - {{jsxref("NaN")}} -- {{jsxref("Operators/void", "void operator")}} +- {{jsxref("Operators/void", "void")}} diff --git a/files/en-us/web/javascript/reference/operators/yield/index.md b/files/en-us/web/javascript/reference/operators/yield/index.md index d73e850af619b00..430047c08dbd323 100644 --- a/files/en-us/web/javascript/reference/operators/yield/index.md +++ b/files/en-us/web/javascript/reference/operators/yield/index.md @@ -143,5 +143,5 @@ console.log(generatorFunc.next(10).value); // 26 - [The Iterator protocol](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) - {{jsxref("Statements/function*", "function*")}} -- {{jsxref("Operators/function*", "function* expression")}} +- [`function*` expression](/en-US/docs/Web/JavaScript/Reference/Operators/function*) - {{jsxref("Operators/yield*", "yield*")}} diff --git a/files/en-us/web/javascript/reference/operators/yield_star_/index.md b/files/en-us/web/javascript/reference/operators/yield_star_/index.md index 1b47fd94b7f210e..bca762fccd92375 100644 --- a/files/en-us/web/javascript/reference/operators/yield_star_/index.md +++ b/files/en-us/web/javascript/reference/operators/yield_star_/index.md @@ -127,5 +127,5 @@ console.log(iterator.next()); // {value: 'foo', done: true} - [The Iterator protocol](/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) - {{jsxref("Statements/function*", "function*")}} -- {{jsxref("Operators/function*", "function* expression")}} +- [`function*` expression](/en-US/docs/Web/JavaScript/Reference/Operators/function*) - {{jsxref("Operators/yield", "yield")}} diff --git a/files/en-us/web/javascript/reference/statements/empty/index.md b/files/en-us/web/javascript/reference/statements/empty/index.md index 0675eaa8718fbc1..70d38ca651d2c28 100644 --- a/files/en-us/web/javascript/reference/statements/empty/index.md +++ b/files/en-us/web/javascript/reference/statements/empty/index.md @@ -68,4 +68,4 @@ if (condition); // Caution, this "if" does nothing! ## See also -- {{jsxref("Statements/block", "Block statement")}} +- [Block statement](/en-US/docs/Web/JavaScript/Reference/Statements/block)