Cesar Jr Rodriguez Cesar Jr Rodriguez - 10 months ago 60
Javascript Question

Why console.log() and alert() functions are not actually part of Javascript and what others functions NOT belong to Javascript core?

Just that. Mozilla's Introduction to OOP in Javascript explains that

function isn't actually part of Javascript itself. So I'm very interested to learn how this kind of functions is implement by the browsers and what kind of convention is used.

Answer Source

JavaScript is a language specification (strictly speaking, ECMAScript).

console, on the other hand, is an API. There are currently 669 Web APIs listed on MDN (to answer your second question). Same goes for window, for example.

Why isn't it part of JavaScript core? The same reason window isn't available to NodeJS (core) or process isn't available in the browser: these APIs are implemented by the environments within which JavaScript runs.

Similarly, why would you implement alert() in NodeJS, where there in no UI within which you could launch a modal with your message?