JavaScript Input(console.log())

In JavaScript, the console.log() method is used to print text to the console. This can be useful for debugging and troubleshooting code.

Syntax:

console.log(message);

Here, “message” is the text that you want to print to the console.

Example:

console.log("Hello, world!");

This will print the text “Hello, world!” to the console.

You can also use variables with console.log() to print the value of the variable to the console.

Example:

let name = "John";
console.log("My name is " + name);

This will print the text “My name is John” to the console.

You can also print multiple variables or messages to the console at the same time by separating them with commas.

Example:

let age = 30;
console.log("My name is " + name, "and I am " + age + " years old.");

Output:

My name is John and I am 30 years old.