Facebook Pixel

What are Web APIs in JavaScript?

Functions provided by the browser (or Node.js) that run outside the JS engine. Examples: setTimeout, fetch, DOM methods, localStorage, geolocation. They handle async operations and push callbacks to queues when done.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in Web APIs in JavaScript Explained

No. They are provided by the browser (or Node.js runtime). The JS engine only knows JavaScript. Web APIs are the host environment's extension to the language. This is why they are not available in a bare JS engine without a host.

You call a Web API (like setTimeout). The Web API runs the operation outside the engine. The engine continues. When the operation completes, the Web API pushes the callback to the microtask or macrotask queue. The event loop moves it to the stack when it is empty.

setTimeout, setInterval, fetch, XMLHttpRequest, WebSocket, DOM methods (querySelector, addEventListener), localStorage, sessionStorage, IndexedDB, geolocation, Canvas, AudioContext, Worker, IntersectionObserver, MutationObserver.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.