answered Jan 21 '18 20:17
Mostly programming / script Language have its own memory management module , where it work as garbage collector which free memory block which is not in use , if this not happen properly than memory stack increase and sometime result is application crash .
when we initialize a variable which is not in use and if it not freed by program it will remain until program run end.so as increase of unused variable / program data , memory use also increase.which is cause memory leak
console.log(logr);// me local
in above example we defined the variable in function it look local and should be garbage collected in the end of function run but when we do acess of it at after run of the function . it is still in memory and it will remain until the program end.its called memory leak .
let me explain how it can be avoid
var logr='me local';