Quiz Entry - updated: 2026.07.14
What is the difference between a browser API and a library?
An API exposes capabilities built into the browser itself, while a library is external code you add to make existing capabilities more convenient.
| Aspect | API | Library |
|---|---|---|
| Source | Built into browser | External code you include |
| Capabilities | Access features beyond pure JS | Convenience, not new features |
| Examples | Canvas, Geolocation, WebStorage, WebGL, WebSockets | jQuery, Bootstrap, Vue.js, W3.CSS, React |
Key distinction:
- APIs extend what JavaScript can do (access hardware, storage, graphics)
- Libraries make existing capabilities easier to use (could implement yourself)
Example: The Geolocation API lets JavaScript access GPS hardware - impossible with pure JS. Bootstrap just provides pre-styled CSS classes - you could write the CSS yourself.