Why doesn't console.log work outside of the function?


#1

I just have a quick question that I can't wrap my head around. In the introduction to javascript you learn that console.log will display what is going on in the background. Can somebody explain why the bottom piece of code doesn't work? The example doesn't say why console.log has to be inside of the function itself.

Thank you,

Edit: Corrected syntax, still doesn't work.

Edit 2: Apparently I got ahead of myself, I am just learning about local and global variables.

Test post, please ignore.


#2

Can you please give the exercise link? As I can see, the console.log is working (as there is no error in the console) but perhaps it makes the SCT unhappy someway so I can only proceed when you give the exercise link.


#3

That function has no return value, so printing its return value should do what?