It's similar to the symbol for approximation which also is accurate for what it's doing cause the integer division approximates the actual value. So that's how I would remember.
But sure I guess you can also throw elephant trunk in there lol.
Don't mind me with my parseInt(22/7)
. The operator seems neat but I don't know if adding more and more operators to a flexible language is a good idea, this might not be clear to read.
That's potentially lossy
>>> int((2**63-1)/2)
4611686018427387904
>>> (2**63-1)//2
4611686018427387903
It doesn't matter, my comment wasn't about that, I wrote JS for years and never had to use parseInt
anyway. Why won't redditors let me at least write it in comments, why do y'all think I need corrections??
You wrote it. Well done. We aren't going to erase your comment. We are just remarking on it the same way you remarked on the post. What horrible thing did the designers of Dart do that you get to tell them it's not good idea, while telling you the same is unfair?
The difference is that I said something off the top of my head, I didn't design a language syntax with poor readability.
Why not just Math.trunc(22/7)
, why convert to string and then parse it, risking getting scientific notation instead of normally formatted number?
parseInt(1000000000000000000000000 / 3) // => 3
Where did you see me convert it to a string? Also I just said the first working thing that came to mind.
In JS parseInt
implicitly converts its argument to a string before parsing
Where did you see me convert it to a string?
Implicitly, when passing as argument to parseInt
More like tildeMostAbusedSymbol, sometimes it's an operator, an alias or a syntactic element. You know this little squiggle has caused a lot of people a lot of grief.
And sometimes it's the home directory
And it's almost impossible to type on a Czech keyboard!
I should build a language where you do database queries with ~/SELECT .... /~ and call it the elephant operator. The language would come with PostgreSQL bindings and nothing else, because elephants.