Pages

FUNCTION HOISTING In Javascript


It is the process in which JavaScript runtime hoists all the functions declared, using the function declaration syntax at the top of JavaScript file. Look at the example, given below:

function logMe() {  
    console.log('Log me in');  
}  
logMe();  // return Log me again
  
function logMe() {  
    console.log('Log me again');  
}  
logMe();  // return Log me again