Re:Advice on JSX Conditionals
by 9wzYQbTYsAIc on Wednesday March 09, 2022 @02:50PM
(#30619150)
if 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.
Would you write: !Boolean(n)
Or would you write: !n