let's play does your code suck JavaScript variables Edition one of these code examples does something annoyingly weird can you tell which [Music] one nope you're wrong it's the bottom one the code with VAR doesn't throw an error but that's actually why it sucks variables with VAR get hoisted to the top of their scope by the JavaScript engine however only the Declaration is hoisted not the value assigned to it which means this confusingly logs out undefined in a large code base that can be a nightmare to debug let on the other hand can only be accessed after the Declaration everything above it is called the temporal dead zone so what we get is a nice clear error that can be easily debugged