Hi, I am Bello Osagie, a tech blogger, writer, and web developer. I teach web development for free… Join me to learn, discover, and have fun coding together!
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
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 whenvar
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