Leakage of global variables

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;

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.

Leave a Reply

Your email address will not be published.