Console

In JavaScript, we use console.log() to write a message (the content of a variable, a given string, etc.) in console. It is mainly used for debugging purposes, ideally to leave a trace of the content of variables during the execution of a program.

Example:

console.log("Welcome to Learn JavaScript Beginners Edition");
let age = 30;
console.log(age);

๐Ÿ“ Tasks:

  • [ ] Write a program to print Hello World on the console. Feel free to try other things as well!
  • [ ] Write a program to print variables to the console.
    1. Declare a variable animal and assign the dragon value to it.
    2. Print the animal variable to the console.

๐Ÿ’ก Hints:

  • Visit the variable chapter to understand more about variables.

results matching ""

    No results matching ""