javascript - equality check with more than 1 var -
i have following code:
const mult = (a, b) => * b; const result = mult(2, 3) + mult(4, 5); const result1 = 6 + mult(4, 5); const result2 = 6 + 20; console.log(result); console.log(result1); console.log(result2); console.log(result === result1 === result2);
the expression result === result1 === result2
equates false when result === result1
true , result1 === result2
true.
can explain why?
it solved left side right, resolving as:
(result === result1) === result2; true === result2;
for example, event fail:
1 === 1 === 1
it due type conversion not done === operator. following resolves true!
1 == 1 == 1
Comments
Post a Comment