ModernNerd Code
Published in

ModernNerd Code

Here’s the Difference Between let and var in Javascript

Reading this might save you hours of debugging a silly error.

This story was originally published on 1Liner.dev.

Take a look at the following code:

// define some fruits
var orange = 'orange';
var apple = 'red';
if (orange === 'orange') {
var orange =

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Lincoln W Daniel

Lincoln W Daniel

Chief Bull @ BullAcademy.org ® Elevating writers @ ManyStories.com. Author @JavaForHumans Ex: Editor in Chief MarkGrowth (acq.), Engineer @Medium @GoPuff