Javascript confusion with console.log - Beginner Q

anUp_and-comer

During my Springboard course my instructor had the following show up in his Web Browser Console: https://i.stack.imgur.com/cZ0f4.png

I want the same results to show up in the Browser Console, however this is what I get: https://i.stack.imgur.com/vqtbF.png

Why, in his code, was he able to have something show up in the console without the console.log? When I attempt this, nothing appears in the console. Also, why am I getting a 1 instead of "you are the worst :("?

I'm into the course only a few days and am still trying to grasp console.log and how VS code connects to a web browser when using HTML and JavaScript.

kiranvj

Why, in his code, was he able to have something show up in the console without the console.log?

The diss function will have the console.log, thats why its printing in console

When I attempt this, nothing appears in the console. Also, why am I getting a 1 instead of "you are the worst :("?

This is because you are printing the return of setTimeout, return of setTimeout will be a positive integer, in your case its 1, that why you see that in console.

There is difference between your inststuctor and your code.

See instructor code line 38-40 there is no console.log

But your code in 8-10 has console.log

That makes the diff in output

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related