// Change values below to test your code
abTest(-2,2);
See i got see below wrong
abTest(-2,2) should return undefined
abTest(2,-2) should return undefined
But just to add: Since apparently the test specifically asks for ‘undefined’ to be returned in those cases, it would be good practice to actually return that ‘undefined’ explicitly, i.e.:
if(a<0 || b<0){
return undefined;
}
This helps readability of your code. People will know that you really do intend to return undefined.
var a = 10;
var b = -1;
console.log(a < 0 || b < 0);
// above displays true because a<0 is false and b<0 is true, so true || false is true
console.log((a || b) < 0)
// displays false because (a || b) is 10 and 10 < 0 is false