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

HTMLMediaElement events

Use nine audio and video events to keep playback position, duration, and controls in sync and to detect a resource reset, playback completion, or a media failure.

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

HTMLOptionElement.value — the value of an HTML option

Read or set the value of one HTML option. A missing `value` attribute makes the property fall back to the option’s text, but an explicitly empty value stays empty.

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

HTMLProgressElement: max and value properties

`max` sets the total amount of work and `value` sets the amount done. A missing `value` attribute means indeterminate progress, not 0% complete.

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

HTMLTemplateElement.content: the inert template fragment

`template.content` exposes a template’s inert contents as a `DocumentFragment`. To reuse the template, copy its subtree into the destination document and insert the copy.

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

Newline normalization in HTMLTextAreaElement.value

Reading `HTMLTextAreaElement.value` returns text with LF line endings, even if the string assigned to it contained CRLF pairs or lone CR characters.

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

Escaping text in HTML

When generating HTML, escape plain text for the position where it will be inserted. When writing directly to an ordinary DOM element, use `textContent` with the original string instead.

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

HTML text escaping versus structural allowlist sanitization

Escape characters to display input as literal text. To preserve selected formatting, sanitize the parsed HTML structure using an explicit policy for elements and attributes.

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

IndexedDB: creating object stores and opening transactions

Use `createObjectStore()` to change the schema during a database upgrade, and `transaction()` to read or write records in existing object stores.

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

IndexedDB: add, read, delete, and replace records

Use `add()`, `getAll()`, `delete()`, and `put()` to work with records by primary key, and distinguish a successful request from a committed transaction.

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

IndexedDB: onupgradeneeded and the upgrade transaction

Change an IndexedDB schema in `onupgradeneeded`, get the upgrade transaction from `request.transaction`, and wait for `success` before using the new schema.

Advanced · Current web platform; runtime support varies
JavaScript

IDBRequest: request result and error

Learn when to read `result` and `error` in IndexedDB and how to tell an individual request's success from a transaction commit.

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

IDBRequest: result, error, and event handlers

Read `result` after an IndexedDB request succeeds and `error` after it fails. A successful request does not mean that its transaction has committed.

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

IndexedDB transaction events: complete, abort, and error

Use `complete` and `abort` to determine the outcome of a whole IndexedDB transaction, and `error` to diagnose a failed individual request.

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

IdleDeadline: callback reason and remaining idle time

`didTimeout` tells you why an idle callback ran; `timeRemaining()` estimates how many milliseconds are left in the current idle period.

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

Immediately invoked function expression (IIFE) syntax

An IIFE creates and calls a function in one expression. Grouping parentheses do not call the function; the argument list that follows them does.

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

Image `load` and `error` events

Handle image loading success and failure on the image element itself. Register both handlers before setting `src`, and do not treat `complete` as proof of success.

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

Immutable updates and structural sharing

Create a new state without mutating the previous version: copy the containers along the update path and reuse unchanged branches.

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