DEV Community

Cover image for Console.log() is not JavaScript
SYED MAZHAR ALI RAZA
SYED MAZHAR ALI RAZA

Posted on

Console.log() is not JavaScript

This might be a heartbreak to a lot of JavaScript developers out there, but the truth is...

The very first line of code you ran as a beginner JS developer, viz console.log(), is not a part of the JavaScript language. Confused? Let me explain.

The console object (whose log method is used to print data on the web console) is one of the "Web APIs" provided by the Browser to the JavaScript Engine, which means it is your browser that is providing this functionality that is in return implemented through JavaScript.

All browsers have a set of built-in Web APIs to support complex operations, such as DOM, Fetch, History, Service Workers, and Web Storage APIs. Now you may wonder, what exactly is a part of JavaScript then?

Well, the parts of JavaScript that are standard across all environments are detailed in the ECMA Specs (primitives, data types, language grammar and syntax, arithmetic and logical operations, built-in objects and functions, etc.). This means that while Array.isArray() is built into JS, setTimeout() and console aren’t.

Do you want to learn more about this? check out this great blog by Nikhil John, where he explains this concept in-depth.

Happy coding :)

10daysofJSfundamentals (Day 1)

Top comments (0)