Menu
Coddy logo textTech

Output

Part of the Fundamentals section of Coddy's JavaScript journey — lesson 28 of 77.

In programming, we often need to show information to the user. This is called output. In JavaScript, the simplest way to output something is to use console.log().

Here's how you can use it:

console.log("This is some text.");

This will print This is some text. to the console.

You can output different types of data, such as numbers and booleans:

console.log(123); // Output: 123
console.log(true); // Output: true

You can also output multiple values at once by separating them with commas:

console.log("Hello", "World", "!"); // Output: Hello World !

This will print each value with a space in between.

Remember, console.log() is mainly used for testing and debugging your code. It's a powerful tool to see what's happening in your program.

challenge icon

Challenge

Beginner

Write a program that outputs the following lines:

Welcome to Coddy!
JavaScript is fun.

Cheat sheet

To output information in JavaScript, use console.log():

console.log("This is some text.");

You can output different types of data:

console.log(123); // numbers
console.log(true); // booleans

Output multiple values by separating them with commas:

console.log("Hello", "World", "!"); // Output: Hello World !

Try it yourself

// Type your code below
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals