The console

The console.log function displays a value.

A value is a unit of information, like the single number 42. Click the button to see what this program does.

Loading TypeScript...

A function is an action that your computer knows how to perform. You can instruct the computer to perform any known function with a function call statement. Notice the parentheses (( and )) around the value, and the comma between values if there is more than one.

function call to console.logmultiple values
console.log(value)

Try experimenting with the program below, which tells the computer to display some numbers and do some simple math.

Loading TypeScript...

Notice that the name of a function must match exactly, otherwise you will encounter a compilation error.

Was this page helpful?