[JavaScript](https://hackernoon.com/tagged/javascript) [ES6](https://hackernoon.com/tagged/es6) has a variety of functions to help the programmer code faster as well as in an efficient manner. Today let’s look at two particular functions, _let_ and _const._ The use of _let_ and _const_ is done as an alternative to the _var_ function during the declaration of variables. Unlike _var_ , _let_ and _const_ are block scoped. Another difference that _let_ and _const_ have when compared to _var_ is the fact that while _var_ gives a _undefined_ error when accessed before declaring, _let_ and _const_ give a _ReferenceError_ if they are accessed before declaration.  const does not allow reassignment The error is due to TDZ, or Temporal Dead Zone. TDZ starts at the beginning of the block where _let_ is declared and ends when _let_ is encountered again in the user code. TDZ is very useful as it helps to avoid bugs which appear when a variable is changed before its declaration is reached. While _let_ and _const_ are similar, they are not exactly the same. The main difference between _let_ and _const_ is that _const_ variables need to be declared using an initializer, or it will generate an error.  let will prevent mistakes of trying to redeclare an already declareed variable Also declaration of the variable with the same name will throw an error. This helps to fix mistakes where one loses a reference when a variable is reassigned. Let and Const are already replacing Var in many codebases, and are additional features of ES6 that will improve code. > [Hacker Noon](http://bit.ly/Hackernoon) is how hackers start their afternoons. We’re a part of the [@AMI](http://bit.ly/atAMIatAMI)family. We are now [accepting submissions](http://bit.ly/hackernoonsubmission) and happy to [discuss advertising &sponsorship](mailto:partners@amipublications.com) opportunities. > To learn more, [read our about page](https://goo.gl/4ofytp), [like/message us on Facebook](http://bit.ly/HackernoonFB), or simply, [tweet/DM @HackerNoon.](https://goo.gl/k7XYbx) > If you enjoyed this story, we recommend reading our [latest tech stories](http://bit.ly/hackernoonlatestt) and [trending tech stories](https://hackernoon.com/trending). Until next time, don’t take the realities of the world for granted!