Skip to content

Hello world

js
console.log('Hello world')

There are many concepts in this simple line:

  • console is an object of the environment: it is not defined in the language (in the ECMAScript standard). It allows displaying what is given to it as arguments: either in the browser console (for browsers), or in the standard output for node.js, Deno, Bun and other JavaScript/TypeScript runtimes;
  • log is a property of the console object;
  • log is a function;
  • In JavaScript, a function is an object, with a superpower: it is invocable (the specification refers to it as a callable object);
  • log is called (also referred to as invoked) as a method on the console object;
  • 'Hello world' is an argument passed to the console.log function, which accepts an almost infinite number of parameters;
  • console.log is a function that displays in the "dev tools" console (Developer Tools) the content of the arguments passed to it: here, "Hello world" will be displayed in the console;
  • Note: the dot syntax found in Java and Python to access a property of an object.