Skip to main content

Command Palette

Search for a command to run...

Console.log() is not JavaScript

Updated
1 min read
Console.log() is not JavaScript
S

I am a 20-year-old engineering sophomore pursuing BTech in Electronics and Communications. I am a frontend web developer well versed in HTML, CSS, JavaScript and React, and stand at a beginner-intermediate level at backend development. I keep a vision to become a full-stack developer (tech stack: MERN).

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)

R
Raj Kumar4y ago

Good Information

1
S

Thanks! If you want to explore more such interesting JavaScript concepts, do check out my other blogs :)

M
MMR Ahmad4y ago

Interesting

1
F

Nice write up btw I noticed the link you shared by Nikhil John isn't working

1
S

Thanks for informing, updated the link :)

1

More from this blog

Syed's Blog

10 posts

Console.log() is not JavaScript