0

Can anyone explain this code

x=[5,10,15]; x.join = x.shift; if(x == 5 && x == 10 && x==15) console.log("good"); //why the above condition return true?

2nd Jun 2020, 12:27 AM
Rayan Alghamdi
Rayan Alghamdi - avatar
1 Answer
+ 3
x = [5,10,15]; /* so */ x = 5, x = 10, x = 15, so x.join = 5, 10, 15 ( x.shift) if x == 5 10 && 15 /* always true */ therefore console.log("good");
2nd Jun 2020, 12:42 AM
BroFar
BroFar - avatar