What is the scope of a variable declared using the var keyword inside a function?

  • Global scope
  • Function scope
  • Block scope
  • Local scope
In JavaScript, a variable declared using the var keyword inside a function has function scope. This means it is accessible within the entire function but not outside of it. Unlike let and const, var does not have block scope.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *