function testSum(){ var expected = 7 var actual = sum(5, 2) if (actual != expected) { console.log("It's broken..") } else { console.log("It works!") } }
I don’t know how to work this out, please help
Advertisement
Answer
You could define a sum
function that takes two numbers and returns the sum i.e.,
the total amount resulting from the addition of two or more numbers, amounts, or items.
“the sum of two prime numbers”
function sum(a, b) { return a + b } function testSum() { var expected = 7 var actual = sum(5, 2) if (actual != expected) { console.log("It's broken..") } else { console.log("It works!") } } testSum()