Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hoisting in JavaScript (variables & functions) ( output issue) #2

Closed
ppm143 opened this issue Jul 27, 2021 · 1 comment
Closed

Hoisting in JavaScript (variables & functions) ( output issue) #2

ppm143 opened this issue Jul 27, 2021 · 1 comment

Comments

@ppm143
Copy link

ppm143 commented Jul 27, 2021

getName(); // undefined
console.log(getName); // Uncaught TypeError: getName is not a function
var getName = function () {
    console.log("Namaste JavaScript");
}
// it is undefined because in arrow function behaves as a variable and not function.

Below is the correct one

getName(); // TypeError: getName is not a function and after this line code will not execute.
console.log(getName); 
var getName = function () {
    console.log("Namaste JavaScript");
}
// it is undefined because in arrow function behaves as a variable and not function.
@alok722
Copy link
Owner

alok722 commented Jul 27, 2021

Thank you for pointing out, will push the fix ASAP. @ppm143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants