Check out this list, some incredibly perfect things for the most special and perfect language there is, love that it powers practically the world: wtfjs
Check out this list, some incredibly perfect things for the most special and perfect language there is, love that it powers practically the world: wtfjs
Because what matters ultimately is not how well made the language is, but how useful it is. The web became the most important platform after mobile - it became bigger than mobile. And JS is its...
Because what matters ultimately is not how well made the language is, but how useful it is.
The web became the most important platform after mobile - it became bigger than mobile. And JS is its native language.
There’s a pithy quote that a programming language is either hated or useful, never both.
The part that’s frustrating is the refusal to improve the core library and instead leave everyone in a “just add this framework” standard. It’s the epitome of coder hubris. “We'll bash it into...
The part that’s frustrating is the refusal to improve the core library and instead leave everyone in a “just add this framework” standard.
It’s the epitome of coder hubris. “We'll bash it into prod in a week and fix it later…. Promise”
They did fix it. New code should use the temporal interface: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal Adding things to JS is no easy matter. It’s...
Adding things to JS is no easy matter. It’s not a matter of hubris, it’s a matter of committee. Unlike other languages, there is no reference implementation of a JS interpreter. Every web browser has its own JS engine, and none of them are the official one. To add something is to convince every JS implementation to agree, from Google to Mozilla to Apple to Samsung.
Really, it only happens fairly often these days because Chrome has such a large influence they can mainly push through whatever they want.
Blame Netscape, ig. It's the only language that'll run client-side code in a web browser (besides WASM, which didn't exist until 2017 and was designed to complement JS rather than replace it...
Blame Netscape, ig. It's the only language that'll run client-side code in a web browser (besides WASM, which didn't exist until 2017 and was designed to complement JS rather than replace it anyway) so it's no wonder it caught on.
I work with this language every single day, and new Date(“maybe 1”) evaluating to 11pm on 30 April 2001 may be one of the most upsetting pieces of news that I’ve ever been delivered. I’ll be...
I work with this language every single day, and new Date(“maybe 1”) evaluating to 11pm on 30 April 2001 may be one of the most upsetting pieces of news that I’ve ever been delivered. I’ll be putting in my notice at work this morning.
This is very common in JavaScript. Almost no browser APIs throw errors, instead we get undefined, NaN, and Invalid Date. I think that the underlying principle is that JavaScript was first designed...
This is very common in JavaScript. Almost no browser APIs throw errors, instead we get undefined, NaN, and Invalid Date. I think that the underlying principle is that JavaScript was first designed to allow some minimal amount of scripting on top of the DOM, and it's "better" for website viewers if the date widget shows up but reads "Invalid Date", then if all of the website's interactivity breaks because of a Date math error.
Okay that was great. Thanks, I feel like I learned something that I will immediately forget and has no practical use, because when would I want to rely on any of that functionality.
Okay that was great.
Thanks, I feel like I learned something that I will immediately forget and has no practical use, because when would I want to rely on any of that functionality.
For all of the non-JS devs in here completely baffled by how monstrously bad the JavaScript Date interface is... We know haha. TC39 has been working on a new set of APIs for time in JavaScript for...
For all of the non-JS devs in here completely baffled by how monstrously bad the JavaScript Date interface is... We know haha. TC39 has been working on a new set of APIs for time in JavaScript for ten years. It's rolling out across the ecosystem now, actually. It launched in Firefox last year, in Chrome last month, and is being worked on actively in Safari. Last month's Chrome launch means that it will likely be available soon in Node.js as well. Deno actually unflagged it two years ago. Seems like Bun is lagging behind a bit but I imagine that they'll race to catch up once Node.js releases it.
Anyway, all that to say, there are a lot of really smart and passionate folks that are trying very hard to make JavaScript better, and Temporal is going to end up being one of the better date and time interfaces across programming languages. And it should start being more broadly available by the end of this year, which is huge!
As much hate as JS gets, with the advent of TypeScript I confidently say it is one of the best programming languages out there that you’ll actually get paid to write. Once you learn how to handle...
As much hate as JS gets, with the advent of TypeScript I confidently say it is one of the best programming languages out there that you’ll actually get paid to write. Once you learn how to handle the problematic bits it’s really really nice. Not suited for all tasks but great for UI, event driven, or IO bound tasks.
I put it above all other interpreted/JITed “scripting” languages. Yes, better than Python. Better than Ruby.
I'm not unbiased here, as over my career I've become almost exclusively a Typescript dev, but I completely agree. Would I have a better time if I got to do what I do now, but in OCaml or Gleam?...
I'm not unbiased here, as over my career I've become almost exclusively a Typescript dev, but I completely agree. Would I have a better time if I got to do what I do now, but in OCaml or Gleam? Yeah, probably. Would I want to use Python, Ruby, Java, or Go instead? Noooo way! JavaScript has been a really nice programming language to write and read since ES6, and it's only gotten better.
How would you recommend someone who doesn't have much experience with JavaScript (or front-end dev at all) learn Typescript? I've seen a lot of fullstack web dev opportunities that require it so...
How would you recommend someone who doesn't have much experience with JavaScript (or front-end dev at all) learn Typescript? I've seen a lot of fullstack web dev opportunities that require it so I'd like to expand my skillset there, but whereas I know where to start when it comes to learning things like Django and Ruby on Rails for the backend, I have no idea where to start with JavaScript or Typescript.
I'm quite experienced with Python, but not in web dev (I worked in Data Science). I've dabbled in some Django tutorials before but haven't ever used it for anything real. I used JavaScript once to...
I'm quite experienced with Python, but not in web dev (I worked in Data Science). I've dabbled in some Django tutorials before but haven't ever used it for anything real. I used JavaScript once to write a tiny Google Apps Script to do something with my google calendar, but it involved mostly just "slightly editing code I found on stack overflow" (I would've been vibe-coding if that had existed yet) and that's the extent of my knowledge there.
You could check out the Odin Project's full-stack JavaScript course. It might feel a little basic if you're already a competent Python developer, but it will cover all of the web development...
You could check out the Odin Project's full-stack JavaScript course. It might feel a little basic if you're already a competent Python developer, but it will cover all of the web development fundamentals (HTML, CSS, DOM manipulation, server-side JavaScript, etc). And it's free!
It notably doesn't cover Typescript, but I think it's not a terrible idea to get started with plain JavaScript anyway, since Typescript only provides static analysis (just like Python's type hints). Once you've worked your way through Odin, the official Typescript handbook is a great way to pick up Typescript. Plus, you'll have a real project to try adding it to from Odin!
Pick a project that suits it well (either front-end web dev or anything that benefits from async/await) that you’re genuinely interested in and just start going. Ask an LLM how to set things up...
Pick a project that suits it well (either front-end web dev or anything that benefits from async/await) that you’re genuinely interested in and just start going. Ask an LLM how to set things up and how things work but don’t let it write your code for you. I recommend using bun instead of node.
The JS Date object is so awful that no sane developer uses it beyond the most trivial use cases. Most of us use wrapper libraries, like Moment.js or date-fns.
The JS Date object is so awful that no sane developer uses it beyond the most trivial use cases. Most of us use wrapper libraries, like Moment.js or date-fns.
I got 11 right somehow despite being very rusty in JavaScript. Nice way to highlight how convoluted the date system is. I was starting to fear it would manually count all months after the start...
I got 11 right somehow despite being very rusty in JavaScript. Nice way to highlight how convoluted the date system is.
I was starting to fear it would manually count all months after the start date one by one... And that may actually be more logical than how it actually works.
This only reminds me why I refuse to code in JavaScript when I can avoid it. So much web design can happen without that sloppy language. I'll write in something else and let it cross-compile into...
This only reminds me why I refuse to code in JavaScript when I can avoid it. So much web design can happen without that sloppy language. I'll write in something else and let it cross-compile into JS for me, thanks.
I've learned quite a few languages over the years and JavaScript is by far the most frustrating work of coding I've ever had the displeasure to work with. I actively avoid it whenever possible...
I've learned quite a few languages over the years and JavaScript is by far the most frustrating work of coding I've ever had the displeasure to work with. I actively avoid it whenever possible because it's just so nonsensical.
What’s worse to me is that Microsoft TypeScript purports to fix all the issues that JavaScript has, but it just introduces its own issues. Every time I end up looking at TypeScript code, it’s rife...
What’s worse to me is that Microsoft TypeScript purports to fix all the issues that JavaScript has, but it just introduces its own issues. Every time I end up looking at TypeScript code, it’s rife with the “any” variable type. Sure, let’s fix all the problems that JavaScript has, but leave a back door to use them just in case. It’s meant to be used judiciously by an experienced programmer, but that’s never stopped a novice from banging on, in my experience. At least this was true the last time I looked at it, but I haven’t bothered to investigate TS in some years.
Even in non-transpired languages, you’re allowed to cast things to the most generic base type and essentially opt out of the type system. Even in C, that’s what void pointers are for. It’s not...
Even in non-transpired languages, you’re allowed to cast things to the most generic base type and essentially opt out of the type system. Even in C, that’s what void pointers are for.
any exists because TypeScript is designed to be gradually implemented into existing JavaScript codebases, so it's meant to be used as a temporary clutch. If there are too many in a project, or if...
Every time I end up looking at TypeScript code, it’s rife with the “any” variable type.
any exists because TypeScript is designed to be gradually implemented into existing JavaScript codebases, so it's meant to be used as a temporary clutch. If there are too many in a project, or if it's used because the developer is lazy, that's on them and it should be rejected in a code review. Linters can be configured to throw errors or warnings when any is used.
It’s meant to be used judiciously by an experienced programmer
Nope, you should use unknown, which forces you to type-check at runtime.
I love TypeScript as much as I hate JavaScript, but you gotta use the typing system correctly. Otherwise your TypeScript project is nothing more than JavaScript with a moustache.
That’s certainly not what I took away from my time with TS, but that’s to be expected. Self study ain’t what it used to be these days… then again, as I’m entirely self taught on all coding...
That’s certainly not what I took away from my time with TS, but that’s to be expected. Self study ain’t what it used to be these days… then again, as I’m entirely self taught on all coding (meaning taught by online articles and not by any formal education system with accreditation) maybe the error lies with the student and not the text.
perfectly sane language for perfectly sane people
Similarly:
Check out this list, some incredibly perfect things for the most special and perfect language there is, love that it powers practically the world: wtfjs
I don’t understand how it took over like it did.
Dates are hard in general, but this handling makes it so much worse.
Because what matters ultimately is not how well made the language is, but how useful it is.
The web became the most important platform after mobile - it became bigger than mobile. And JS is its native language.
There’s a pithy quote that a programming language is either hated or useful, never both.
The part that’s frustrating is the refusal to improve the core library and instead leave everyone in a “just add this framework” standard.
It’s the epitome of coder hubris. “We'll bash it into prod in a week and fix it later…. Promise”
They did fix it. New code should use the temporal interface: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal
Adding things to JS is no easy matter. It’s not a matter of hubris, it’s a matter of committee. Unlike other languages, there is no reference implementation of a JS interpreter. Every web browser has its own JS engine, and none of them are the official one. To add something is to convince every JS implementation to agree, from Google to Mozilla to Apple to Samsung.
Really, it only happens fairly often these days because Chrome has such a large influence they can mainly push through whatever they want.
Promise is built in now!
I tend to step in and out of using js. Seems like each time I come back there’s a different recommended date library.
Blame Netscape, ig. It's the only language that'll run client-side code in a web browser (besides WASM, which didn't exist until 2017 and was designed to complement JS rather than replace it anyway) so it's no wonder it caught on.
I work with this language every single day, and
new Date(“maybe 1”)evaluating to 11pm on 30 April 2001 may be one of the most upsetting pieces of news that I’ve ever been delivered. I’ll be putting in my notice at work this morning.It's annoying that is not even consistent, on Firefox returns "Invalid Date"
I’m going to cry.
Separately, am I being silly here in not understanding why Invalid Date date objects even exist? Why not just throw an error?
This is very common in JavaScript. Almost no browser APIs throw errors, instead we get
undefined,NaN, andInvalid Date. I think that the underlying principle is that JavaScript was first designed to allow some minimal amount of scripting on top of the DOM, and it's "better" for website viewers if the date widget shows up but reads "Invalid Date", then if all of the website's interactivity breaks because of a Date math error.So, how would you define the end of your notice period using the Date class? c:
Obligatory link (one of my favorite ever lightning talks): https://www.destroyallsoftware.com/talks/wat
Okay that was great.
Thanks, I feel like I learned something that I will immediately forget and has no practical use, because when would I want to rely on any of that functionality.
For all of the non-JS devs in here completely baffled by how monstrously bad the JavaScript Date interface is... We know haha. TC39 has been working on a new set of APIs for time in JavaScript for ten years. It's rolling out across the ecosystem now, actually. It launched in Firefox last year, in Chrome last month, and is being worked on actively in Safari. Last month's Chrome launch means that it will likely be available soon in Node.js as well. Deno actually unflagged it two years ago. Seems like Bun is lagging behind a bit but I imagine that they'll race to catch up once Node.js releases it.
Anyway, all that to say, there are a lot of really smart and passionate folks that are trying very hard to make JavaScript better, and Temporal is going to end up being one of the better date and time interfaces across programming languages. And it should start being more broadly available by the end of this year, which is huge!
As much hate as JS gets, with the advent of TypeScript I confidently say it is one of the best programming languages out there that you’ll actually get paid to write. Once you learn how to handle the problematic bits it’s really really nice. Not suited for all tasks but great for UI, event driven, or IO bound tasks.
I put it above all other interpreted/JITed “scripting” languages. Yes, better than Python. Better than Ruby.
I'm not unbiased here, as over my career I've become almost exclusively a Typescript dev, but I completely agree. Would I have a better time if I got to do what I do now, but in OCaml or Gleam? Yeah, probably. Would I want to use Python, Ruby, Java, or Go instead? Noooo way! JavaScript has been a really nice programming language to write and read since ES6, and it's only gotten better.
How would you recommend someone who doesn't have much experience with JavaScript (or front-end dev at all) learn Typescript? I've seen a lot of fullstack web dev opportunities that require it so I'd like to expand my skillset there, but whereas I know where to start when it comes to learning things like Django and Ruby on Rails for the backend, I have no idea where to start with JavaScript or Typescript.
What is your current experience like?
I'm quite experienced with Python, but not in web dev (I worked in Data Science). I've dabbled in some Django tutorials before but haven't ever used it for anything real. I used JavaScript once to write a tiny Google Apps Script to do something with my google calendar, but it involved mostly just "slightly editing code I found on stack overflow" (I would've been vibe-coding if that had existed yet) and that's the extent of my knowledge there.
You could check out the Odin Project's full-stack JavaScript course. It might feel a little basic if you're already a competent Python developer, but it will cover all of the web development fundamentals (HTML, CSS, DOM manipulation, server-side JavaScript, etc). And it's free!
It notably doesn't cover Typescript, but I think it's not a terrible idea to get started with plain JavaScript anyway, since Typescript only provides static analysis (just like Python's type hints). Once you've worked your way through Odin, the official Typescript handbook is a great way to pick up Typescript. Plus, you'll have a real project to try adding it to from Odin!
Pick a project that suits it well (either front-end web dev or anything that benefits from async/await) that you’re genuinely interested in and just start going. Ask an LLM how to set things up and how things work but don’t let it write your code for you. I recommend using bun instead of node.
Got like 8 wrong in a row and rage quit. I actually like js but man it has to be one of the oddest non-esoteric languages in existence.
Managed to get 13 right without knowing JS, but this is truly insane. What even are these type coercions. Truly glad to not be a webdev lol.
The JS Date object is so awful that no sane developer uses it beyond the most trivial use cases. Most of us use wrapper libraries, like Moment.js or date-fns.
You learn to stick with Date.now() or quick calls to a formatting method.
I got 11 right somehow despite being very rusty in JavaScript. Nice way to highlight how convoluted the date system is.
I was starting to fear it would manually count all months after the start date one by one... And that may actually be more logical than how it actually works.
This only reminds me why I refuse to code in JavaScript when I can avoid it. So much web design can happen without that sloppy language. I'll write in something else and let it cross-compile into JS for me, thanks.
I've learned quite a few languages over the years and JavaScript is by far the most frustrating work of coding I've ever had the displeasure to work with. I actively avoid it whenever possible because it's just so nonsensical.
What’s worse to me is that Microsoft TypeScript purports to fix all the issues that JavaScript has, but it just introduces its own issues. Every time I end up looking at TypeScript code, it’s rife with the “any” variable type. Sure, let’s fix all the problems that JavaScript has, but leave a back door to use them just in case. It’s meant to be used judiciously by an experienced programmer, but that’s never stopped a novice from banging on, in my experience. At least this was true the last time I looked at it, but I haven’t bothered to investigate TS in some years.
Even in non-transpired languages, you’re allowed to cast things to the most generic base type and essentially opt out of the type system. Even in C, that’s what void pointers are for.
It’s not really an option not to have.
Even Rust has
unsafein some core libraries!anyexists because TypeScript is designed to be gradually implemented into existing JavaScript codebases, so it's meant to be used as a temporary clutch. If there are too many in a project, or if it's used because the developer is lazy, that's on them and it should be rejected in a code review. Linters can be configured to throw errors or warnings whenanyis used.Nope, you should use
unknown, which forces you to type-check at runtime.I love TypeScript as much as I hate JavaScript, but you gotta use the typing system correctly. Otherwise your TypeScript project is nothing more than JavaScript with a moustache.
That’s certainly not what I took away from my time with TS, but that’s to be expected. Self study ain’t what it used to be these days… then again, as I’m entirely self taught on all coding (meaning taught by online articles and not by any formal education system with accreditation) maybe the error lies with the student and not the text.
JavaScript is one of the greatest crimes ever committed in the history of software.