why when i paste my code in playcode.io it works like this
function Nums(args) {
let n = Number(args[0]);
let p1 = 0;
let p2 = 0;
let p3 = 0;
let p4 = 0;
let p5 = 0;
for (let i = 1; i < n; i++) {
let currentNum = Number(args[i])
if (currentNum < 200) {
p1++;
} else if (currentNum < 400) {
p2++;
} else if (currentNum < 600) {
p3++;
} else if (currentNum < 800) {
p4++;
} else if (currentNum <= 1000) {
p5++;
}
}
console.log(p1);
console.log(p2);
console.log(p3);
console.log(p4);
console.log(p5);
}
Nums(["4", "1", "3", "999"]);
I want to sort some numbers but aren't arrays starting from 0,why when i type 4 as first number calcs it correct? if i type 2 it places my 1 and 3 if fist variable and the last varibale is empty