Object.prototype, property descriptors, and accessors
Separate where a property is found in the prototype chain from how it behaves: it can store a value or use a getter or setter.
CKTIS / JavaScript
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
Separate where a property is found in the prototype chain from how it behaves: it can store a value or use a getter or setter.
Use property shorthand when a variable and its property share a name. Use brackets to compute a key when defining, reading, or writing a property.
Distinguish shorthand properties and concise methods in object literals from reading, writing, and calling properties with keys determined at runtime.
Create properties from existing variables and define methods without `function`. Distinguish property shorthand from computed keys and destructuring.
Track one drag by `pointerId` and finish it only once: commit on release or abort on cancellation or early loss of capture.
Keep the drag preview separate from the committed value, and settle the drag only once even when capture loss follows release.
Use `pointerId` to tell simultaneously active pointers apart, and `clientX` and `clientY` to locate an event in the viewport in CSS pixels.
`pointerId` links events from the same active pointer; `isPrimary` tells you whether that pointer is primary for its input type.
Transferring an `ArrayBuffer` with `postMessage()` detaches the sender’s buffer before delivery. Without a transfer list, the bytes are copied.
`Promise.allSettled()` fulfills with an array of outcomes in input order once all input promises have settled. Read each record’s `status` to decide whether to use `value` or `reason`.
The Promise constructor supplies two functions to its executor. The first call to either locks in the promise’s outcome, but it does not always settle the promise immediately.
Dot notation names a fixed key; bracket notation computes one. Either form can read stored data or trigger a getter or setter, depending on the property.
Use dot notation for a fixed name and brackets for a computed key. Learn how private access differs and exactly when optional chaining skips a read.
The `value` field holds a data property's stored value. Omitting it from an input descriptor is different from explicitly specifying `value: undefined`.
The `get` and `set` traps intercept property reads and writes. Passing `receiver` to `Reflect` preserves the receiver of the original operation.
Read a DOM range’s boundary points, find their closest shared node, and tell whether both boundaries refer to the exact same point.
Cut, insert, and delete DOM content. Learn how to position a range, collapse it to a single point, and tell what `cloneRange()` copies.
Choose what a pattern can match, how many times it can repeat, and where it can match. Combine these tools to validate an entire string or find a matching line.
Learn how global, case-insensitive, multiline, and Unicode-aware matching work together, and how to match letters or other characters by Unicode property.
Read where the full match starts and what each named group captured. Use the `d` flag when you also need start and end offsets.
Read captured text by name and reuse it in replacement strings or callbacks, including when an optional group does not match.
The `s`, `u`, `i`, and `g` flags control dot matching across line breaks, Unicode-aware matching, case-insensitive matching, and global search, respectively.
Require or rule out context immediately before or after a position in a string without including that context in the full match.
Match letters, combining marks, and numeric characters across scripts, and tell uppercase letters apart from titlecase letters.