Js this problem

function foo(num) {
    console.log("foo: " + num);//6 7 8 9
    this.countPP;
}

foo.count = 0;

var i;
for(i = 0; i < 10; iPP){
    if(i > 5){
        foo( i );
    }
}
console.log(foo.count);// 0
console.log(count);//NaN

outputs 6, br, 7, 8, and 9, I know, and

outputs 0 because this.count points to the global.
the question is why the hidden test count created is NaN?.

It suddenly occurred to me that
called the foo function and implicitly tried to create a global attribute count,
count = undefined. Undefined PP is NaN?.

Mar.11,2021

this.count is global. If it is not defined, of course undefined PP, is NaN


count is not defined. What you define is foo


function foo(num) {
    console.log("foo: " + num);//6 7 8 9
    this.countPP;// window.countPP  Number(undefined)PP
}
console.log(count);//NaN

count initial value undefined
PP operation on undefined, so that count becomes NaN


undefined count

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35f78-41018.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35f78-41018.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?