I often test the output of JavaScript functions manually (by simply looking at the output of each function in the console), and this can often be quite tedious. In JavaScript, is there any way to test the output of a series of function calls automatically, and return all tests that did not produce the expected results?
checkOutput([["add(1, 2)", 3], ["add(2, 2)", 4]]); //if the input does not match the output in one of these arrays, then return the function call(s) that didn't produce the correct output
function checkOutput(functionArray){
//this function is not yet implemented, and should return a list of function calls that did not produce correct output (if there are any).
}
function add(num1, num2){
return num1 + num2;
}