The height is not been declared in function and global scope but the variable will declare for us. Thus, this is something that in past with JavaScript. It causes a lot of problems
.
function weird(){
height = 50;
return height;
}
weird()
This is actually called leakage of global variables
.
Prevent the problem
The "use strict"
directive was new in ECMAScript version 5.
use strict was introduced as a way to prevent JavaScript for doing some unpredictable
cases.