Because when let is used to create a variable within a block scope ({ ... }), the variable is only available in it. This type of variables are called local variables; while when var is used to create a variable within a block scope ({ ... }), the variable is available everywhere in the program (within or outside the scope). This type of variables are called global variables
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, i don't understand why hello variable is not defined.
We know it has been declared like greeting variable.
Because when
letis used to create a variable within a block scope ({ ... }), the variable is only available in it. This type of variables are called local variables; while whenvaris used to create a variable within a block scope ({ ... }), the variable is available everywhere in the program (within or outside the scope). This type of variables are called global variables