Lex Fridman has given many long interviews on popular podcasts. Still, the episodes with legendary programmer John Carmack have the freewheeling feel of a director's cut.Over the course of his five hours, Carmack went from vector arithmetic to doom. But what really justifies the extended run time is something Fridman is upfront about. “If we were living in a simulation, I think it would be written in JavaScript.”
To review: JavaScript is what makes static web pages “dynamic.” Without it, the Internet would be nothing more than a dead, dark, after-hours arcade. These days, the language is used for both front-end and back-end development across mobile platforms and apps like Slack and Discord. And in the context of Fridman's nerdy koan, the main thing to understand about this is: Any self-respecting programmer will actually admit that: preference JavaScript is kind of a sham, much like what arthouse filmmakers confess to Marvel fans.
I think this has something to do with the fact that JavaScript was created in less time than it takes to homebrew a bottle of kombucha (10 days). In 1995, Netscape hired a programmer named Brendan Eich to create his Netscape Navigator, a language that was embedded in browsers. The language was originally called LiveScript, but was renamed JavaScript to capitalize on the hype for an unrelated language called Java that had been introduced earlier that year. (Programmers asked about the difference between Java and JavaScript will joke, “Java is to JavaScript what a car is to carpet.”) To this day, JavaScript is a particularly well-designed Few people think of it as a language. Especially Eich. “I think he committed JavaScript in 1995 and has been making amends ever since,” he once said.
What exactly was his crime? You can easily find tons of blog posts, memes, and Reddit threads sandbagging JavaScript, but my favorite is his four-minute piece titled “Wat” by software engineer Gary Bernhardt. This is a lecture. First, imagine showing a group of non-English speakers the present and past tense of the following verbs. bring to a boil (bring to a boil/boiled) and bite (bite/bit). Next, when I asked them how to use it, eatwho can blame me for answering? eat/ateSimilarly, the story of “Watt” is a terrible reel of JavaScript quirks and unpredictable behavior.? Suppose you want to sort a list of numbers. [50, 100, 1, 10, 9, 5]. Calling the built-in sort function in any sane language will return a list in ascending numerical order. [1, 5, 9, 10, 50, 100]. Running this in JavaScript returns the following result [1, 10, 100, 5, 50, 9]Here, 10 and 100 are considered greater than 5. Why? Because JavaScript interprets each number as a string type and sorts lexically instead of numerically. Total madness.
When Fridman says that JavaScript runs the world, what he means, in other words, is that our world, like the underlying source code, is deeply confusing and incomprehensible. It's like declaring with a sigh that the Universal Declaration of Human Rights must have been written in Comic Sans, given the dire state of the planet.
at this point To be honest, JavaScript is not my favorite language, but I like it. In fact, I love it. Therefore, I can't help but feel a flame of disapproval whenever a particular group of programmers makes a case against it. Often they focus on deficiencies that were addressed years ago. To dwell on JavaScript's original shortcomings is to overlook the fact that all software, and all programming languages, are essentially suites of software that are easy to revise and improve.