Hoisting in javascript

hoisting, javascript

Solution

This is not the same. Your multiple `var` declaration also declares `setTimeout`:

var temp = setTimeout,
    setTimeout = function() {};

which is hoisted to

var temp; // = undefined
var setTimeout; // = undefined
temp = setTimeout;
setTimeout = function() {};

Problem

I asked a question before and somebody give me a guide and I read it and I saw this ``` var temp = setTimeout, setTimeout = function() {}; ``` He said that temp will be undefined due to JavaScript hoisting and I dont understand why Its not should be like that? ``` var temp; temp = setTimeout; setTimeout = function() {}; ``` so why its undefined?

Original source