Skip to content

Window.ready method

Window › ready

Official

Executes a function when the DOM is ready.

Signature:

ready(fn: () => unknown): void

Parameters:

ParameterTypeDescription
fn() => unknownThe function to execute when the DOM is ready.

Returns: void

Example:

ready(() => {
console.log('DOM is ready');
});