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

瘦欲@ 提交于 2019-12-09 15:39:34

问题


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

Is it a part of ES ?


回答1:


From MDN:

Specification WHATWG HTML Living Standard

… and you won't see it in ECMA-262 5.1.




回答2:


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 :

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




回答3:


It is part of the window object in the browser, not defined in ECMAScript. Therefore, other environments such as Node are not guaranteed to have it.



来源:https://stackoverflow.com/questions/36754971/is-settimeout-a-part-of-javascript-it-self-or-it-is-just-an-api-that-the-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!