0% found this document useful (0 votes)
41 views

JAVASCRIPT Programming Foundations - Udacity

This document introduces the JavaScript console and console.log function. The console allows debugging code without long-term effects and displays output and errors. Console.log prints content to the console for debugging. For example, console.log("hiya friend!") prints the string. The document demonstrates using console.log in a for loop to print numbers 0 through 9.

Uploaded by

Apuyor Victory
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

JAVASCRIPT Programming Foundations - Udacity

This document introduces the JavaScript console and console.log function. The console allows debugging code without long-term effects and displays output and errors. Console.log prints content to the console for debugging. For example, console.log("hiya friend!") prints the string. The document demonstrates using console.log in a for loop to print numbers 0 through 9.

Uploaded by

Apuyor Victory
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

;

Lesson 1:
console.log
What is JavaScript?

SEARCH

RESOURCES

CONCEPTS

1. Intro to JavaScript

2. History of JavaScript

3. The JavaScript Console

4. Developer Tools on Different Bro…

5. console.log
The Console Is Your Coding Sandbox
The console is a great place to mess around with your code without any long-ter
6. JavaScript Demo
console will tell you if there any warnings or errors on the page, display any outp
console.log .
7. Summary

Using console.log statements


console.log is used to display content to the JavaScript console. Run the fol
console:

console.log("hiya friend!");

Prints: "hiya friend!"

This can be very helpful to figure out what is going on when you are debugging y

NOTE: You may see some errors or warnings in the console from the site you're visitin
Warnings are very common and will not affect the code that you write in these course

Troubleshooting
For Chrome users, if you don't see the output, click “Default levels” in the console
"Info" is checked. Congratulations! You performed the log action on the debug

The message you’ve logged is "hiya friend!". hiya friend! is a string (a seque

Give It a Try!
Let’s use console.log to do something a little more interesting. Here’s a block
that loops through the numbers 0 through 9 and prints them out to the console:

for (var i = 0; i < 10; i++) {

console.log(i);

You might also like