What is up with var, let and const

Assuming you know some JS basics Let’s start with the ‘old’ keyword var for declaring variables. var is top level (aka. global level). Let me show you what that means with an example. function logName(setName){ if(setName){ var name = 'Dennis'; console.log(name); } else { console.log(name); } } logName(true); // 'Dennis' Returns Dennis as expected. logName(false); […]