Console is not responding as expected

Hi, I was practicing to use console following an example. console did not respond to function calls and variable declaration for some reasons. But console.log, operators, and alert seem to be working fine. Can someone explain why?? Thanks!

sorry, that was not the screenshot that I meant to show. this is the one

I don’t understand. What are you trying to do? What is not behaving as you expect?

So you are only assigning the variable called “name” to a string “Ringo”. The variable is never called in the console, it so that’s why it comes up as undefined. So after you assign the variable, if your write

console.log(name);

it should output “Ringo” in the console.

1 Like

I was expecting that after typing in that, the console would automatically return the value of the variable?

Thanks, but the function call is still not working though

Did you define the function via the console?

ahh, I see, It’s working now. Thanks! so the console is not able to call the functions written in the script itself, right?

There’s tons of javascript functions in your browser for the website you’re on at any given time. You can’t just access those from the console without a few shenanagins.

1 Like

haha, that sounds very devious. Thanks for your help

:smiley: Not particularly devious, but it requires digging around and fiddling.