JavaScript Program to Write to Console

Example: Using console.log()

Output

8
hello
hello
Hello John
Hello John
{
  age: 28,
  name: "John"
}

The console.log() method is used to write to the console. You can pass values directly into the method or pass a variable to write to a console.