Compare within margin challenge

Link to challenge is here:

function closeCompare(a, b, margin){
 if (Math.abs(a-b)<margin) {
      return 0
    } else if (a<b) {
    return -1
    } else {
      return 1

Why is the above code not passing the challenge?

In bold the parts you are missing in your implementation:

The second one, you can give a default value to parameters

1 Like

Thank you, I got it now!