document.write(('b' + 'a' + + 'a' + 'a').toLowerCase());
This outputs "banana"
document.write(('b' + 'a' + + 'a' + 'a').toLowerCase());
This outputs "banana"
Jesus, I thought you made a typo until I tried it. Gotta love those unary operators...
Could someone explains this to some of us who haven't learnt these cancer yet?
Javascript has a tendency to "just work" even when it might be a better idea not to. That is achieved by making assumptions and defaulting to certain pre-defined behaviors where most other languages would just stop. Unless something truly catastrophic happens, JS always tries to find a way to keep the code running. Good or bad, that's by design just how it works.
That is an example of this tendency. Normally the " 'a' + + 'a' " bit should be an error case, because that does not make sense. Where most programming languages would throw and error and stop execution, javascript just soldiers on. It assumes the center bit is an addition of numbers. Except since there's no number there, it automatically injects the value that represents invalid numbers, which is "nan" for "not a number". Then, since that "number" is surrounded by letters, it parses that number into a text value, which is the string "nan" itself. And then finally it adds all the letters together to form a banana.
There are plenty of weird ways to get JS to give you stupid results back. Shit like these are not bugs with the language, it's just JS working as intended. Except the way language works as intended can lead to actual bugs very easily, is the problem.
That means it's free.
Not necessarily, they may just take payment in BJs
Nilfs.
well... it's true, that is not a number.
Sorry Nan, but we really need that squash
Sodium nitride
Na~3~N
Very dangerous. If you buy this, NaN money will be deducted from your bank account and thus your resulting amount of money will also be NaN.
I'm sure it's got sodium and nitrogen in it š¤·
Free squash.
Goes well with naan bread.
You can't fool me. Nan is flat. These aren't flat.
Nan died of a stroke. We buried her 3 years ago.
Composted , reincarnated
Kabocha. Amen
I watched a video about these the other day some dude on YouTube seems to have hacked together a program to put whatever you want on them you can find the video here if you're interested here
Little Bobby String we call him...
Where I live, shopkeepers are obliged to use the posted prices if it advantages the consumer.
Is there a subtle way that one might damage these digital price tags to fuck up the store's aspirations at surge pricing? You know, so we can watch to make sure nobody does that...
Ay LMAO
Seriously?
Not a nutmeg?
Did you try sum(squash[0, 3], na.rm = TRUE)?
Technically correct
Forget comparing apples to oranges. I'm comparing squash kabochas to numbers (they aren't)
Once upon a time, when programmers still tested their code before moving them to production,...
Is this some fucked up form of sodium azide I'm too stupid to understand
Finally, gourded Sodium Azide
Welcome to /c/SoftwareGore!
This is a community where you can poke fun at nasty software. This community is your go-to destination to look at the most cringe-worthy and facepalm-inducing moments of software gone wrong. Whether it's a user interface that defies all logic, a crash that leaves you in disbelief, silly bugs or glitches that make you go crazy, or an error message that feels like it was written by an unpaid intern, this is the place to see them all!
Remember to read the rules before you make a post or comment!
Community Rules - Click to expand
These rules are subject to change at any time with or without prior notice. (last updated: 7th December 2023 - Introduction of Rule 11 with one sub-rule prohibiting posting of AI content)
You should also check out these awesome communities!