Last active
August 13, 2018 18:05
-
-
Save rupeshtiwari/fb9add642fde66f85894bd57bed22f5f to your computer and use it in GitHub Desktop.
JavaScript Concepts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log(); | |
var log = function(msg) { | |
alert(msg); | |
} | |
/* | |
* in this case log function is a expression type and log varibale will be hoisted at the top | |
* and initialized with undefined therefore, we will get | |
* Uncaught TypeError: log is not a function | |
*/ | |
// in below example log function will be called since all of the function declarations are hoinsted at the top before runing code. | |
log(); | |
function log(msg) { | |
alert(msg); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment