I want to check if a number is negative. I’m searching for the easiest way, so a predefined JavaScript function would be the best, but I didn’t find anything yet. Here is what I have so far, but I don’t think that this is a good way:
function negative(number) {
if (number.match(/^-\d+$/)) {
return true;
} else {
return false;
}
}