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

ValidityState: overall validity and specific failures

Read `element.validity` to distinguish an overall valid state from a missing required value, a format mismatch, or a user-edited value that is too short.

Intermediate · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

Page lifecycle events: visibility, leaving, and returning

Tell a hidden tab from an attempted departure or a back/forward cache restore, so you can save state, warn about unsaved edits, and resume work at the right time.

Advanced · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

WAAPI: keyframe arrays and timing options

Pass a keyframe array to `Element.animate()` and use a separate options object to set how long each iteration lasts, how it progresses, and how many times it runs.

Intermediate · Current web platform; runtime support varies
JavaScript

WeakMap.prototype.delete() — remove an entry

Call `weakMap.delete(key)` to remove the entry for a given key. It returns `true` if it removed an entry and `false` if it did not.

Basic · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

WeakMap.get() — read a value by key

`weakMap.get(key)` returns the value stored for a key. Use `has(key)` to tell a missing entry apart from one whose value is `undefined`.

Basic · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

WeakMap.prototype.get() — read a value by key

Use `weakMap.get(key)` to read a stored value without changing the map. Use `has()` to tell a missing entry apart from one whose value is `undefined`.

Basic · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

WeakMap: read, write, and delete entries

Learn what `get`, `set`, and `delete` return, which keys a `WeakMap` accepts, and how to tell a missing entry from one whose stored value is `undefined`.

Intermediate · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

WeakMap.prototype.set(): store a value for a key

Use `set()` to insert an entry into a `WeakMap` or replace the value for an existing key. It returns the same map so you can chain calls.

Basic · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

WeakMap.set(): add or replace a value

Use `set()` to store a value under a key in a `WeakMap`. It replaces the value if the key already exists and returns the same map, so you can chain calls.

Basic · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

WeakSet: checking and adding members with has() and add()

Use `has()` to check whether a value belongs to a `WeakSet` and `add()` to insert it. Membership is based on identity, and the collection does not keep its members alive.

Intermediate · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

WeakSet: checking, adding, and deleting members

Use `has()` to check membership, `add()` to insert a value, and `delete()` to remove it. The three methods differ in what they return and how they handle invalid values.

Intermediate · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

wheel, pagehide, pageshow, and beforeunload events

Distinguish wheel input from scrolling, detect when a page resumes from the back/forward cache, and warn users before unsaved changes are lost.

Advanced · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

Window.CSS.supports — detect CSS feature support

Use JavaScript to test whether the browser supports a specific CSS property–value pair or satisfies a CSS support condition before choosing an enhanced behavior.

Advanced · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

Reading `visibility` with `window.getComputedStyle()`

Read the browser’s resolved CSS `visibility` value and distinguish it from the declaration stored in an element’s inline style.

Intermediate · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

Window.matchMedia and MediaQueryList.matches

Check whether a CSS media query currently matches in JavaScript, and respond only when the match result changes.

Intermediate · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

Window.parent, Window.self, and Window.origin

Distinguish references to the current and parent windows from a serialized origin, and learn why having a window reference does not grant access to its document.

Advanced · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

`Window` events: `popstate` and `hashchange`

Use `popstate` to read the state of an activated history entry and `hashchange` to detect a URL fragment change within the same document.

Intermediate · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

Window `resize` event

Listen for `resize` on `window` to respond to layout viewport size changes. Use `ResizeObserver` when you need to track the size of an individual element.

Intermediate · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

Worker: handling `message`, `error`, and `messageerror`

Tell apart three dedicated worker events: successful message delivery, a worker error, and a message the receiver cannot deserialize.

Advanced · ECMAScript 2024 and the current web platform; runtime support varies
JavaScript

WritableStream sink: start, write, close, and abort

Four optional sink callbacks define how a writable stream initializes its destination, writes chunks, finalizes successful output, or cleans up after an abort.

Advanced · ECMAScript 2024 and the current web platform; runtime support varies