SyntaxFix
Write A Post
Hire A Developer
Questions
function negative(n) { return n < 0; }
Your regex should work fine for string numbers, but this is probably faster. (edited from comment in similar answer above, conversion with +n is not needed.)
+n