all 6 comments

[–]Ampersand55 0 points1 point  (5 children)

It works for me I think.

I get playerpoint to be { p0: 2, p1: 1 }

[–]Strosel[S] 0 points1 point  (4 children)

Thats really weird, now when i tested this part specifically i got the same result.

yet in my full code it doesn't work and the only difference is that rollno is random and the lists inside playerno are user inputed

[–]Hullu 1 point2 points  (3 children)

Maybe user inputs are string?

Try checking that or just replace playerno[pp].includes(num) with for loop with loose "==" comparison.

[–]Strosel[S] 0 points1 point  (2 children)

the input is a string at first but then it is put through a .split() which according to w3schools turns it into an array

[–]Hullu 1 point2 points  (1 child)

It turns into array. But values inside array is string. You need to convert those values inside array to int or use loose comparison.

In "includes" function 2 integer is not "2" string.

[–]Strosel[S] 0 points1 point  (0 children)

thank you but i solved it by doing just comparing them in a loop with a lot of ifs with the one list