Page 1 of 1

sending information to the console

Posted: Tue Apr 23, 2024 6:37 pm
by ProjectX
The console allows you to print and view JavaScript output. You can send information to the console using console.log(). For example, this code will print "Naomi" to the console:
let developer = "Naomi";
console.log(developer);
The code above accesses the developer variable with its name in the console.log(). Note that the value between the parentheses is the value that will be printed.

Print the value of the character variable to the console. Then, click the "Console" button to view the JavaScript console.
let character = 'hello';
console.log(character)

Re: sending information to the console

Posted: Tue Apr 23, 2024 6:52 pm
by ProjectX
When a variable is declared with the let keyword, you can reassign (or change the value of) that variable later on. In this example, the value of programmer is changed from "Naomi" to "CamperChan".
let programmer = "Naomi";
programmer = "CamperChan";
Note that when reassigning a variable that has already been declared, you do not use the let keyword.

After your console.log, assign the value "World" to your character variable.
let character = 'Hello';
console.log(character);
character = "World";