Hacker News new | past | comments | ask | show | jobs | submit login

"!!" should be pretty obvious to any javascript developer.



Nonetheless, better for the industry if we start to embrace more uniformity in our idioms.

You can practically copy-and-paste between JavaScript and C# these days, with some trivial text replacement tweaks, if you are careful with your idioms.


What if you wanted to get the boolean value of number but with not.

Would you write: !Boolean(n)

Or would you write: !n


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.


It might be, but not everyone knows js and I don't expect future people to be me.

More obvious and more readable is always better




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: