I’ve struggled to complete the ‘Passing Values to Functions with Arguments’ task. I did look at the forums and watched the video that goes with it too. I then started to delete some of my work to try and work it out step by step, trying to complete each test one at a time.
I did this and I somehow completed all of them with half as much code as I thought I needed.
Code:
function functionWithArgs(a, b) {
console.log(a + b);
}
If you understand correctly, your code passed and you just want to know where test 3 and 4 came from and how you passed them.
In that case, I can explain that these are called edge cases. In the background, fCC does some test to see if your code is bullet proof. So they pass different values to your function and see if it outputs a pre-determined answers. You wont see these tests as fCC does it in the background. But basically, test three runs your function with 7 and 9 as the arguments and check if the answer is 16. If it is, you get a pass. You can learn more about edge cases on Google and checkout hackerrank, which runs your code against many more edge cases.
Edge cases a common part of algorithms, as there is a need to check whether your will consistently produce correct results given different arguments.