In the following JavaScript code saySomething() writes "Hello there!" but not "Hello you!". Does this indicate that hoisting only applies to the first var within a scope?
var whatToSay = 'Hello World!';
function saySomething() {
if (!whatToSay) {
var whatToSay = 'Hello there!';
}
document.write(whatToSay);
var whatToSay = 'Hello you!';
}
saySomething();
Here is a link to the JS Bin http://jsbin.com/fiyimefeso/1/edit?js,output