Javascript Variables

Variables must be declared or execution may halt. You can use typeof to test an undeclared variable, however. undefined is the data type for undelared variables and the value for uninitialized variables. You can declare objects, but you can't access nonexistent subproperties. Functions that don't return a value are evaluated as undefined. Void evaluates the given expression and returns undefined. Execution will halt if you try to void an undeclared variable. var is the original way to define variables. Variables declared with var can work outside of the blocks they were declared in. Their practice is discouraged, nowadays, in favor of let and const. Var declarations are processed first, so variables can be used before they're declared. That trick doesn't work with let declarations, however. "let" declares block level variables while variables declared with var are visible to the local function. "const" declares a constant value which cannot be changed. You can change the contents of constant objects, however.