3 ms·
What if you wanted to get the boolean value of number but with not. Would you write: !Boolean(n) Or would you write: !n
by postalrat 5y ago
What if you wanted to get the boolean value of number but with not.
Would you write: !Boolean(n)
Or would you write: !n
- 9wzYQbTYsAIc 5y agoif it were C#, I’d write it along the lines of !(n as bool), but for the purposes of JS, I suppose something like: const IsNumber = (value) => Boolean(value); !IsNumber(n) I’m not a fan of using the return-type as the function name, especially when you are really just trying to find out if something is a number.