Regular expression word boundaries and noncapturing groups
Use `\b` and `\B` to test for word boundaries, and `(?:...)` to group alternatives without adding a capture.
CKTIS / JavaScript
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
Use `\b` and `\B` to test for word boundaries, and `(?:...)` to group alternatives without adding a capture.
Use `target` to identify which element an entry describes and `contentRect` to read its reported dimensions, excluding padding and borders for an HTML element.
Choose the right target for scroll and resize notifications, and learn when a passive listener changes whether you can cancel a default action.
`rangeCount` tells you how many ranges a document selection contains, and `addRange()` adds a DOM range. To replace the selection with one range across browsers, clear it first.
Compare a LIFO stack, a FIFO queue built from two stacks, and an LRU cache that evicts the least recently used entry when it exceeds capacity.
`length` counts stored entries, and `key(index)` returns a key name by position. The browser does not guarantee the order of those positions.
The `"use strict"` directive opts a classic script or a function into strict mode. ECMAScript modules and class definitions are already strict.
A tag function receives a template literal’s text segments and substitution values separately. The tag’s return value becomes the value of the whole expression.
Build multiline strings and insert expression results. Learn when JavaScript produces a string and when it passes text segments and values to a tag function.
Template literals let you write multiline text and interpolate expressions. A tagged template passes text segments and substitution values separately to a function.
Decode bytes into JavaScript text, choose how to handle malformed sequences and a leading byte order mark, and finish decoding input split across chunks.
Encode text as UTF-8 and read the resulting byte count. Distinguish that count from UTF-16 code units, typed-array elements, and the size of the entire backing buffer.
`throttle` limits how often a function runs even when calls keep arriving. Use it, for example, to reduce the work done during scrolling.
Process input chunks with `transform()`, emit results with `controller.enqueue()`, and release buffered output with `flush()` on normal close.
Distinguish the whole buffer from a typed array’s byte range and element count, and see what its getters report after resizing or detachment.
Distinguish the backing buffer object (`.buffer`), the view's element count (`.length`) and byte count (`.byteLength`), and the whole buffer's current byte count (`.buffer.byteLength`).
`length` counts elements in a typed array view, not bytes. Bracket indexing starts at zero, and writing past the end does not extend the view.
`subarray()` creates a view of the same buffer, while `slice()` copies the selected elements into a separate buffer by default. Both interpret range bounds the same way.
Unary minus `-x` converts one operand to a numeric value and then negates it. The result is a `Number` or a `BigInt`.
JavaScript measures string length in UTF-16 code units, iterates by code point, and uses `Intl.Segmenter` to find grapheme cluster boundaries.
Use `hash` to read or change the fragment and `href` to read or replace the whole URL. The `hash` getter alone cannot distinguish an empty fragment from an absent one.
Distinguish a parsed URL’s origin, path, and query, and read individual query parameters without splitting the address by hand.
JavaScript string length counts UTF-16 code units, not Unicode code points or user-perceived characters. The distinction matters when indexing, slicing, or iterating over text.
Distinguish code units, code points, and grapheme clusters. Check whether a string is well-formed UTF-16 and choose a normalization form for text comparison.