How to unset variable using javascript?
<p>This is what I tried so far.</p>

<pre><code>var nxt = 'I am next';

window.onscroll = function(){
    var scr = this.pageYOffset;

    if(scr &gt; 400){
        console.log(nxt);
        delete(nxt); // unset here
        console.log(nxt); // expected undefined or null
    }
}
</code></pre>

<p>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? </p>

<p>Any help would be appreciated.</p>