undefinedfix
Sign in

How much is the output

Compufreak edited in Thu, 02 Jun 2022
var n = 1;
function test(){
    var n = n+1;
    alert(n);
};
test();
1 Replies
wpqwi
commented on Thu, 02 Jun 2022
var n = 1;
function test(){
    var n; // undefined
    n = n + 1; // undefined + 1 => NaN
    alert(n);
};
test();
lock This question has been locked and the reply function has been disabled.