Code highlights logo

Learn

Getting Started with JavaScript

Console Output

One of the most common uses of the console is to display messages and information during the runtime of your program. This can be helpful for debugging purposes or providing feedback to the user.

The console.log() Function

The console.log() function is used to log messages to the console. It accepts one or more parameters, enclosed in parentheses, which can be strings, numbers, objects, or variables. For example:

1console.log("Hello, world!");
2console.log(42);
3console.log(true);

Instructions

1.

Add a console.log() statement to output the string "This is a string".

2.

Add a console.log() statement to output the number 10.

3.

Add a console.log() statement to output the boolean value false.

Sign up to start coding

Already have an account?

Sign In

Course content