var hoistedNumber = 1; // initialised declaration
var h1 = document.createElement('h1');
var num1 = document.createElement('h2');
var num2 = document.createElement('h2');
h1.textContent = 'Answer is... ' + (hoistedNumber + hoistedNumber2);
num1.textContent = "Num1 is: " + hoistedNumber;
num2.textContent = "Num2 is: " + hoistedNumber2; // error - undefined
document.body.appendChild(h1);
document.body.appendChild(num1);
document.body.appendChild(num2);
var hoistedNumber2 = 3; // initialised declaration
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.