this post was submitted on 11 Jul 2025
241 points (98.8% liked)

Programming

22134 readers
367 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
top 50 comments
sorted by: hot top controversial new old
[–] bleistift2@sopuli.xyz 38 points 1 month ago (3 children)

I am a frontend dev. JavaScript (well, TypeScript) is my bread and butter. Even knowing its quirks I never would have thought how inconsistent Date actually is. I encourage everyone to try this quiz.

This is what JavaScript haters should bring forth, not 0.1 + 0.2 !== 0.3!

[–] Hotzilla@sopuli.xyz 26 points 1 month ago (1 children)

Floating point rounding issues are basic comp science issues. Hopefully nobody thinks that those are JavaScript quirks.

[–] bleistift2@sopuli.xyz 5 points 1 month ago

Unfortunately, people do.

[–] Tanoh@lemmy.world 13 points 1 month ago (1 children)

There is a reason almost everyone use some Date lib, like Luxon and not the built in. And well, having a horrible built in lib that they can't change due to legacy code breaking is nothing really new or unique to JS.

[–] bleistift2@sopuli.xyz 2 points 1 month ago (1 children)

The built-in lib is fine for basic stuff unless you do some crazy shit like expecting "2" to parse as a valid date.

[–] Tanoh@lemmy.world 4 points 1 month ago

For very basic things maybe, but it has a lot of other weird problems and restrictions. Mutability, no real timezone support, very limited arithmetic, to name a few. As soon as you move beyond the very basic, you want someting more robust.

[–] dalekcaan@feddit.nl 3 points 1 month ago

Or the ones where people point out how inconsistent JS is with adding strings to numbers.

Yeah, maybe don't do arithmetic on numbers as strings?

[–] brb@sh.itjust.works 30 points 1 month ago (1 children)

Except for some reason "2" is interpreted as a month, and the year is set to 2001.

Aight I'm out

[–] humanspiral@lemmy.ca 8 points 1 month ago

"12.1" is interpreted as the date December 1st, and as before for dates with no year the default is 2001 because of course.

it gets better and more coherent the deeper you go :P

[–] DrWorm@piefed.social 27 points 1 month ago (1 children)

The quirks in this quiz aren’t even universal, and vary based on which browser you’re using. See the table at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse#non-standard_date_strings

Also I got 13/28 😑

[–] SirQuack@feddit.nl 3 points 1 month ago

7/28 and I program in JS and typescript daily...

[–] ragingHungryPanda@lemmy.zip 26 points 1 month ago

I got 10/28, but I was crying after the 7th question

[–] hperrin@lemmy.ca 22 points 1 month ago

I scored 13/28 on https://jsdate.wtf/ and all I got was this lousy text to share on social media.

Oof. I’ve been a JS dev since 1998.

[–] lunarul@lemmy.world 20 points 1 month ago* (last edited 1 month ago) (1 children)

If you're not very familiar with JS, watch the Wat talk before taking the quiz to know what to expect from this wonderful language.

[–] Lemminary@lemmy.world 8 points 1 month ago

And then promptly get yourself familiar with how the language actually works. https://github.com/getify/You-Dont-Know-JS

People who complain about JS often assume it has features of other languages and fail to realize it has its own architecture and winding history.

[–] thenextguy@lemmy.world 17 points 1 month ago* (last edited 1 month ago)

Alright, enough making fun of languages that suck…let’s talk about JavaScript.

https://www.destroyallsoftware.com/talks/wat

[–] FizzyOrange@programming.dev 13 points 1 month ago

Ha this is even worse than I could have imagined!

[–] tatterdemalion@programming.dev 11 points 1 month ago (10 children)

Can we start a new web with a better language/platform already?

[–] FizzyOrange@programming.dev 5 points 1 month ago (1 children)

Google tried to do that with Dart, and failed. In fairness Dart 1 was much worse than Dart 2... So maybe that was a good thing because there's no way they'd have been able to improve Dart as much as they have if it was part of the web.

For dates there finally is something better anyway: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal

[–] sudo_halt@lemmygrad.ml 4 points 1 month ago* (last edited 1 month ago)

Dart is fucking amazing and it compiles to native code, transpiles to JS (with some restrictions on concurrency because of web workers) and also supports WASM.

Really if you want to write async and stream based code Dart is very good

[–] syklemil@discuss.tchncs.de 2 points 1 month ago (1 children)

There's wasm if you need to target browsers.

[–] festus@lemmy.ca 7 points 1 month ago* (last edited 1 month ago)

Yes and no. Wasm has no "standard library" so if you wanted to use Dates, your wasm would need to have its own implemation bundled for when the user visits the page. Ditto for everything else including string support! As you can imagine having to ship all this basic functionality can bloat the wasm and slow page loads.

You also can't fully escape JS, as the only way wasm can interact with the page & browser are through the JS functions you write and make available to your wasm. I suppose you could take advantage of this to not have to ship your own standard library & use the JS Date implementation, but at that point why not just use JS?

Wasm has strengths but it's not suitable for replacing JS for everyday websites.

load more comments (8 replies)
[–] atzanteol@sh.itjust.works 10 points 1 month ago

Nobody understands JavaScript. It's the quantum mechanics of the software world.

[–] humanspiral@lemmy.ca 10 points 1 month ago (1 children)

Can we sue Oracle back for any of this?

[–] BatmanAoD@programming.dev 1 points 1 month ago* (last edited 1 month ago) (1 children)

Oracle? Oracle owns Java, not JavaScript.

Edit: mea culpa! Sun owned both!

[–] humanspiral@lemmy.ca 6 points 1 month ago (1 children)

They ended up with Javascript trademark (afaik, because the name was too close to Java) too. Sued node.js over something related.

[–] BatmanAoD@programming.dev 4 points 1 month ago (1 children)

Apparently the JS name was selected and announced in partnership with Sun from the very beginning, and Sun had the copyright over both Java and JapaScript up until the acquisition by Oracle. I had no idea, but that makes perfect sense.

[–] humanspiral@lemmy.ca 1 points 1 month ago

Sun, afaiu, was part of a large committee on js without any particular leadership. They got the committee to agree to giving it trademark by complaining/threatening that the name was too close to java. Sun got trademark 4 years after Netscape started support for js. ECMAscript was mostly the same committee without SUN ownership/trademark.

[–] Macallan@lemmy.world 10 points 1 month ago (1 children)

I got a 4/28 and got told I would have scored higher if I guessed at random. Ouch. (I am not a dev)

[–] Ephera@lemmy.ml 5 points 1 month ago

I mean, for what it's worth, I'm a seasoned dev and just did a run where I tried to answer everything as it makes sense to me (which is "throws an error" or "invalid date" for all of them) and I also got a score of 4/28.

...and two of those points were given to me, because the quiz interpreted my answer differently than I meant it.

In other words, this quiz exists to highlight that JavaScript's Date functions make no sense.

[–] mesamunefire@piefed.social 9 points 1 month ago

I did not do well:

"I scored 9/28 on https://jsdate.wtf/ and all I got was this lousy text to share on social media."

Ive been a dev for a long time. Im glad im not doing javascript all that much anymore.

[–] catalyst@lemmy.world 7 points 1 month ago

It only took one question for me to start wanting to flip tables.

[–] LPThinker@lemmy.world 6 points 1 month ago

Thank god Temporal is finally in Stage 3, and already rolled out in Firefox. I can't wait to be done with JS's Date forever.

[–] mr_satan@lemmy.zip 6 points 1 month ago

I scored 10/28 on https://jsdate.wtf/ and all I got was this lousy text to share on social media.

[–] tleb@lemmy.ca 6 points 1 month ago

I scored 17/28 on https://jsdate.wtf/ and all I got was this lousy text to share on social media.

Idk anything about Date but got pretty far with intuition of JS whackiness

[–] anton@lemmy.blahaj.zone 5 points 1 month ago (1 children)

Great quiz. It teaches you the rules while training you to expect the unexpected, even in the rare cases that the rules are applied consistently.
I got exactly half the questions right.

[–] salmoura@lemmy.eco.br 5 points 1 month ago (2 children)

I scored 8/28 on https://jsdate.wtf/ and all I got was this lousy text to share on social media.

don't tap for spoilersThe sequence of questions about new Date("0"), new Date("1"), and new Date("2") got me good.

[–] bamboo@lemmy.blahaj.zone 3 points 1 month ago

That was so funny, I had to pause taking the quiz I was laughing so hard at question 9. The snark in the explanations is fantastic.

[–] mesamunefire@piefed.social 1 points 1 month ago

Same. I think I got one on accident too.

[–] fubarx@lemmy.world 5 points 1 month ago

9/28. WTF'ing through 90% of the questions.

[–] schnurrito@discuss.tchncs.de 4 points 1 month ago

7/28. Of course no one would ever do most of those things, they are interesting to think about but with little practical use.

[–] MTK@lemmy.world 1 points 1 month ago

This is just a good reminder of human nature to make bad choices (using JS) and stick with them forever.

[–] badbytes@lemmy.world 1 points 1 month ago

Not the best with js, but that quiz was fun.

[–] Sorse@discuss.tchncs.de 1 points 1 month ago

12/28

Surprised that I got this score when I only know python

load more comments
view more: next ›