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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -