Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

Knowledge base — JavaScript

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 1003

JavaScript

String.prototype.repeat — repeating text

The repeat(count) method returns consecutive copies of a string without changing the original. A Symbol or BigInt count causes TypeError during numeric conversion. If conversion and truncation yield a negative integer or either infinity, the method throws RangeError.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.replace — replacing text

replace() returns text with matches replaced, without changing the original. Learn the difference between string and regular-expression searches, and between replacement templates and replacement functions.

Intermediate · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.replaceAll — replacing all matches

replaceAll replaces every non-overlapping match of a string or global regular expression without changing the original string. The replacement can be text or a function.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.search — find a pattern's match index

The search() method finds the first regular-expression match and returns its index or -1. A string argument is interpreted as a pattern, not as a literal substring.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.slice — extracting part of a string

String.prototype.slice returns part of a string from start inclusive to end exclusive without changing the original. Negative indices count from the end, and omitting end extracts the rest of the string.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.split — splitting text into an array

String.prototype.split divides text at a separator and returns an array of parts. Learn how limits and empty elements work, and how an empty separator differs from an omitted separator.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.startsWith — checking a string prefix

The startsWith method checks whether a string has a given prefix at its beginning or exactly at a specified position. It returns a boolean, is case-sensitive, and does not modify the string.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.substring — extracting part of a string

substring() returns the portion of a string between start and end, excluding end. It leaves the original unchanged, clamps indices to the string length, and swaps the boundaries when they are reversed.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.toLowerCase() — lowercase conversion

The toLowerCase() method returns a string converted to lowercase using Unicode rules, without changing the original. It takes no parameters and does not adapt its result to the user's language.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.toString() — retrieving a string value

String.prototype.toString() returns the primitive string value of a string or String object. It is not a general converter: an incompatible this value causes a TypeError.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.toUpperCase() — convert letters to uppercase

The toUpperCase() method returns text with letters converted to uppercase using Unicode default casing rules. It leaves the original unchanged, takes no arguments, and can change the length of the result.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.trim() — removing whitespace from both ends

trim() returns text without leading and trailing whitespace or line terminators. It leaves the original string and internal spacing unchanged and does not accept an argument specifying which characters to remove.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.prototype.trimEnd() — removing trailing whitespace

trimEnd() returns a string without trailing whitespace and line terminators. If the string contains only those characters, it returns an empty string. The original is unchanged.

Basic · ECMAScript 2019. The main ECMAScript specification defines String.prototype.trimRight as a legacy alias whose initial value is the same function object as String.prototype.trimEnd.
JavaScript

String.prototype.trimStart() — remove leading whitespace

trimStart() returns text with leading whitespace and line terminators defined by ECMAScript removed. It leaves the original string unchanged and preserves characters inside the text and at its end.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

String.raw — raw template literal segments

String.raw is a static method used as a template literal tag. It preserves the spelling of sequences such as \n in literal text segments, while still evaluating ${...} expressions and inserting their values.

Intermediate · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

Symbol.asyncIterator — the asynchronous iteration protocol

Symbol.asyncIterator is a built-in symbol identifying the method that supplies an object's async iterator. It lets for await...of retrieve successive values while awaiting the results of next().

Intermediate · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

Symbol.for() — symbols from a shared registry

Symbol.for(key) looks up a symbol in the global registry by a string key. It returns the existing symbol or creates and registers a new one, allowing independent pieces of code to obtain the same symbol property key.

Intermediate · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

Symbol.iterator — the synchronous iteration protocol

Symbol.iterator is the well-known symbol identifying an iterator-producing method. It lets a custom object work with for...of and array spread. An iterable supplies an iterator, while the iterator supplies successive results through next().

Intermediate · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

Symbol.toPrimitive — custom object-to-primitive conversion

Symbol.toPrimitive is a well-known symbol identifying an object's primitive-conversion method. The method receives the hint "string", "number", or "default" and takes precedence over the ordinary use of valueOf() and toString().

Intermediate · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

Symbol.toStringTag — a custom object tag

Symbol.toStringTag is a well-known symbol used as the property key that supplies the tag in Object.prototype.toString() output. It changes an object's description, not its actual type.

Intermediate · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

SyntaxError — syntax errors

SyntaxError indicates a parsing failure in code or text that requires a particular syntax, such as JSON. Learn the difference between an error that prevents a script from running and an exception thrown during execution.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

TypedArray.byteLength — view length in bytes

The byteLength property reports the number of bytes covered by a typed array view, not its element count or the size of its entire buffer. It is read from an instance and has no setter.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

TypedArray: sizes, indexing, views, and copies

Learn the difference between element counts and byte counts in TypedArray. See how buffer and byteOffset describe a view and why subarray() shares data while slice() creates an independent copy.

Intermediate · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
JavaScript

TypedArray.length — number of elements in a view

TypedArray.length denotes the number of elements in a typed array, not its byte count. Read it from an instance, such as values.length; it is not a way to resize the view.

Basic · ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support