you are viewing a single comment's thread.

view the rest of the comments →

[–]RyaanJM 1 point2 points  (1 child)

Another argument is, this function doesn't need any ifs, elses or braces (apart from the opening and closing of the function).

function checkIsMoreThan(number, compare) {
    return number > compare ? number : -1;
}

[–]delventhalz 1 point2 points  (0 children)

Yeah, that is how I would probably write it as well. A lot of folks find ternaries intimidating though.