The code mentioned above is incorrect:
var value =" Hello World";
setTimeout( (function( randomValue) {
return function() { console.log( randomValue); }
}) ( randomValue), 1000);
value =" End";
It should have been :
var value =" Hello World";
setTimeout( (function( randomValue) {
return function() { console.log( randomValue); }
}) (value), 1000);
value =" End";