How to display a message or value in the browser console using JavaScript?

To display a message or value in the browser console using JavaScript, you can use the console.log() function.

Here's an example:

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

This will output "Hello, World!" in the console. You can also output variables or other values:

let num = 10; console.log(num);

This will output the value of the num variable in the console.

You can also display multiple values by separating them with commas:

let num1 = 5; let num2 = 7; console.log("The sum of", num1, "and", num2, "is", num1 + num2);

This will output "The sum of 5 and 7 is 12" in the console.