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

Reflect.getOwnPropertyDescriptor — inspect an own property

Reflect.getOwnPropertyDescriptor(target, key) returns an own property's descriptor or undefined. It lets you inspect a property's value, accessors, and attributes without searching the prototype chain.

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

Reflect.getPrototypeOf — reading an object's prototype

Reflect.getPrototypeOf(target) returns an object's immediate prototype or null. It requires an object: primitive values cause a TypeError rather than the wrapper conversion performed by Object.getPrototypeOf.

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

Reflect.has — checking whether a property exists

`Reflect.has(target, propertyKey)` returns a boolean. When the object and its entire prototype chain consist of ordinary objects, it distinguishes a missing property from an existing own or inherited property, even if its value is `undefined`. A `Proxy` object's `has` trap can change 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

Reflect.isExtensible — checking object extensibility

Reflect.isExtensible(target) checks whether an object is extensible. For an ordinary object, extensibility means that new own properties can be added. The method returns a boolean and throws TypeError for primitive 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

Reflect.ownKeys — all own property keys

Reflect.ownKeys(target) requires an object. For an ordinary object, it returns an array of all own string and symbol keys, including non-enumerable ones, and excludes inherited properties. A Proxy's ownKeys trap can change which keys are returned.

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

Reflect.preventExtensions — preventing object extension

Reflect.preventExtensions(target) prevents new own properties from being added to an object and returns a Boolean result. It does not freeze existing properties and can still throw exceptions.

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

Reflect.set — property assignment with a boolean result

Reflect.set performs a property assignment operation and returns a boolean indicating success. Its optional receiver separates the object where property lookup begins from the recipient of the write.

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

Reflect.setPrototypeOf — setting an object's prototype

Reflect.setPrototypeOf(target, proto) attempts to set an object's prototype and returns a boolean result. It distinguishes a rejected change from invalid arguments, which cause TypeError.

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

RegExp.prototype.exec — matching and capture groups

RegExp.prototype.exec searches for a match and returns an array containing the matched text and captures, or null. The g and y flags make successive calls use and update lastIndex.

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

RegExp.prototype.flags — reading regular expression flags

The flags property returns a regular expression's flags as a string in a fixed order, regardless of their order at creation. It is an accessor without a setter, not a method.

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

RegExp lastIndex — the next match position

lastIndex stores the next search position for regular expressions with g or y. It is a writable property of each RegExp instance, not a prototype property.

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

RegExp.prototype.source — regular expression pattern text

The source property returns a RegExp pattern's text without enclosing slashes or flags. Use it to inspect a pattern or reconstruct an expression with new RegExp(), passing its flags separately.

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

RegExp.prototype.test — checking for a match

The test() method checks whether a regular expression matches text and returns true or false. The g and y flags make matching use lastIndex, so repeated calls can produce different results.

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

Set.prototype.add — adding a value to a set

Set.prototype.add(value) adds a single value to a set if it is not already present. It mutates the existing Set and returns that same object, allowing calls to be chained.

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

Set.prototype.clear() — remove all elements

Set.prototype.clear() removes every element from an existing Set and returns undefined. It mutates the same object, so every reference to that object observes the emptied collection.

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

Set.prototype.delete — removing a value from a set

Set.prototype.delete(value) removes the specified value from an existing set. It returns true if removal occurred, or false if the value was absent. Objects are matched by identity rather than by their contents.

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

Set.prototype.difference — set difference

The difference() method returns a new Set containing elements of the receiving set that are absent from the other set. It preserves their order and does not itself modify the input sets.

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

Set.prototype.entries() — an iterator of value pairs

Set.prototype.entries() returns an iterator of [value, value] pairs in insertion order. The first position is not an index: Set stores no separate keys. Consume the iterator with next(), for...of, or spread syntax.

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

Set.prototype.forEach — running a callback for set values

Set.prototype.forEach calls a function for set values in insertion order. It passes the value twice and the set itself, and the method returns undefined.

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

Set.prototype.has — checking value membership

Set.prototype.has checks whether a set contains a given value and returns true or false. It does not modify the set; values are compared using SameValueZero, and objects are compared by identity.

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

Set.prototype.intersection — common set elements

The intersection(other) method returns a new Set containing values shared by both collections. Result order depends on the operands’ sizes; other may also be an object exposing the set-like interface.

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

Set.prototype.isDisjointFrom — testing whether sets are disjoint

Set.prototype.isDisjointFrom checks whether a set has no elements in common with another set or a set-like object. It returns a Boolean rather than creating a new set.

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

Set.prototype.isSubsetOf — testing subset membership

Set.prototype.isSubsetOf checks whether every element of a set occurs in another set or set-like object. It returns a boolean; equal sets also satisfy this condition.

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

Set.prototype.isSupersetOf — testing for a superset

The isSupersetOf() method checks whether a Set contains every element of another set-like collection. It returns a boolean; equal sets also satisfy the condition, so this is not a proper-superset test.

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