
Understanding Variables and Data Types in JavaScript
So imagine this, you are going to work, and you carry a backpack. That backpack contains laptop, ID card and pen. Just like that in Javascript the variables are like the backpack that stores some information which can be used to execute programs. In technical term we can say "Variables are the name of the memory space where we store information". In Javascript variables are of 3 keywords:- let const var let keyword In simple terms, the let keyword in JavaScript is used to create a container for a value that can be changed later. Example: let name = " Satya " console . log ( name ) // Satya name = " Omm " console . log ( name ) // Omm The most important part is that the let variable is only accessible inside the braces and is hidden from the rest of the program, which helps prevent mistakes (bugs) in your code unless it is declared in a global scope. That is why it is called block-scope. In JavaScript, scope is the mechanism that determines the accessibility (visibility) of variables, f
Continue reading on Dev.to Webdev
Opens in a new tab




