0

Write a JavaScript program to check two numbers and return true if one of the number is 100 or if the the sum of the two numbers

const isEqualTo100 = (a,b) => a === 100 || b === 100 || (a+b) === 100; Is this Correct?

21st Dec 2019, 9:33 AM
Karthick Mathesh
Karthick Mathesh - avatar
2 Respostas
0
I checked with this values. console.log(isEqualTo100(100,0)); console.log(isEqualTo100(0,100)); console.log(isEqualTo100(10,0)); console.log(isEqualTo100(0,10)); console.log(isEqualTo100(50,50)); console.log(isEqualTo100(40,60)); console.log(isEqualTo100(100,100)); I'm getting this result: true true false false true true true // I have problem with this result it should be false because both are 100 ?
21st Dec 2019, 9:47 AM
Karthick Mathesh
Karthick Mathesh - avatar