Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is setTimeout a part of JavaScript it self or it is just an api that the browser provides?

Is setTimeout a part of JavaScript it self or it is just an api that the browser provides ?

Is it a part of ES ?

like image 270
faressoft Avatar asked Apr 20 '16 20:04

faressoft


People also ask

Is setTimeout a Web API?

setTimeout() - Web APIs.

How does setTimeout work in JavaScript?

The setTimeout() method executes a block of code after the specified time. The method executes the code only once. The commonly used syntax of JavaScript setTimeout is: setTimeout(function, milliseconds);

Is setTimeout an inbuilt function?

There are two most common built-in timer functions, setTimeout and setInterval , which can be used to call a function at a later time. For an example usage: setTimeout(function () { console.

What we can use instead of setTimeout in JavaScript?

The setTimeout() is executed only once. If you need repeated executions, use setInterval() instead. Use the clearTimeout() method to prevent the function from starting.


1 Answers

The setTimeout() function is actually exposed by the browser's window object as as such they aren't necessarily defined in the ECMAScript specification because they're not JavaScript features, they are features of the browser itself.

You can see from the specification section in the previously linked documentation that it uses the WHATWG HTML Living Standard :

enter image description here

As opposed to a Javascript function like split() that explicitly uses EMACScript :

enter image description here

like image 129
Rion Williams Avatar answered Sep 20 '22 09:09

Rion Williams