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?
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");