This is what I tried so far.
var nxt = 'I am next';
window.onscroll = function(){
var scr = this.pageYOffset;
if(scr > 400){
console.log(nxt);
delete(nxt); // unset here
console.log(nxt); // expected undefined or null
}
}
I used delete() expecting to remove the reference value inside the variable. Unluckily, it just remain the same. Can somebody give me a clue on how to achieve this kind of scenario?
Any help would be appreciated.