I initialized two variables count and user, and I changed their value in the loop. Why does the function always return [0, 0] on finish?
Here's my code:
function getMonthSubs(month) { // month are the name of folders
    var cb = {count: 0, user: 0}, userTemp = [];
    readdir('./log/' + month, 'utf-8', function (err, files) { // files e.g. '2021_11_30.json'
        if (err) return [-1, -1]; 
        else {
            for (let j = 0; j < files.length; j++) {
                let temp = JSON.parse(readFileSync('./log/' + month + '/' + files[j], 'utf-8'));
                for (var key in temp) {
                    cb.count += temp[key].length;
                    if (!userTemp.includes(key)) {
                        userTemp.push(key);
                        cb.user++;
                    }
                }
            }
        }
    });
    return Array(cb.count, cb.user); // [0, 0]
}
