Closed eduardomoroni closed 5 years ago
funny! which browser did you use to get this result? Can you try it again in chrome in a new tab? It seems that you declared variable bar
before somewhere?
I got the same console message. Seems like Javascript throws away the function name when function is written as expression, please find attached image
You can also create one more question on similar lines, i.e. what will be output of following two lines
Answer to your first message:
well, besically you replaced
bar
withy
and got the same result as in the book.
Answer to your second message:
Wait a minute, your second message doesn't explain anything, check out what x is, it's just an object. It's also kinda convoluted, because you have x in the name of a variable and x in the name of a function. The new function construction is not a way to create functions, the result of a new operator will just be an empty object.
What I don' understand is why 3 is printed, hmm...
@eduardomoroni still need help from you with this question
Sorry @ganqqwerty, Just tried again:
I'm using Google Chrome Version 70.0.3538.77 (Official Build) (64-bit)
I'm getting: Uncaught ReferenceError: bar is not defined
which is the expected output.
not exactly