The square bracket is not typed, the {} object gets converted into a string representation which is [object Object]. These square brackets then have regex meaning, match anything inside of them. The o matches Mom, there is nothing in the brackets that match Dad.
Despite having a 3 year old account with 150k comment Karma, Reddit has classified me as a 'Low' scoring contributor and that results in my comments being filtered out of my favorite subreddits.
So, I'm removing these poor contributions. I'm sorry if this was a comment that could have been useful for you.
Despite having a 3 year old account with 150k comment Karma, Reddit has classified me as a 'Low' scoring contributor and that results in my comments being filtered out of my favorite subreddits.
So, I'm removing these poor contributions. I'm sorry if this was a comment that could have been useful for you.
parseInt with arity 1 interprets its argument as a string representing a base-ten int and stops parsing when it encounters the first character that doesn't make sense for that. Numbers are doubles/float64s, Number.MIN_VALUE gives you the smallest positive value representable by that which is 5e-324. parseInt stops parsing that with the e.
parseInt with arity 2 takes the base as the second argument, you can do convenient things like parseInt(parseInt, 35) which is 1021464698788.
Despite having a 3 year old account with 150k comment Karma, Reddit has classified me as a 'Low' scoring contributor and that results in my comments being filtered out of my favorite subreddits.
So, I'm removing these poor contributions. I'm sorry if this was a comment that could have been useful for you.
Every "javascript is weird" behavior comes from its philosophy of "programs should never, ever crash". And I will always maintain that that is a bad philosophy.
That’s not even true though. If I write false+[], that returns ”false”. But if I write false***[], that’s a parse error.
So I can write programs that “crash” in JavaScript - the question more is, why doesn’t false+[] do the saner thing of just throwing an error/exception? JavaScript’s rule of coercing any operand involved with addition to a String UNLESS every operand is a number doesn’t really make much sense at all…
Because it’s not breaking down and analyzing it. It’s just producing text that looks as similar as possible to what text of someone breaking it down and analyzing it would look like.
The best formulation of this concept ive heard. It's insane that "producing text that looks like code that does what you asked" or "producing text that looks like debugging your code" will do those things.
View all comments
3.1k
u/Ambitious-Finance-83 Mar 20 '24
can't wait for this to come up in an interview...