Lex Friedman has done many long interviews on his popular podcast. However, the episode with legendary programmer John Cormack has felt an unknown director’s cut. Over five hours, Carmack delves into everything from Vickers’ actions punishment. But it’s something Friedman says, offhand, that really justifies the extended runtime: “I think if we live in a simulation, it’s written in JavaScript.”
To review: JavaScript is what makes static web pages “dynamic”. Without it, the Internet would be nothing, like an after-hours arcade, lifeless and dark. These days, the language is used in both front-end and back-end development for a whole host of mobile platforms and apps, including Slack and Discord. And the main thing to understand about it, in terms of Fridman’s nerdy koan, is this: for any self-confident programmer, to actually admit to like JavaScript is something of a faux pas – much like an art-house filmmaker who admits to Marvel fandom.
I think it has something to do with the fact that JavaScript was created in less time than it takes to make a jar of kombucha at home: 10 days. In 1995, Netscape hired a programmer named Brendan Hitch to develop the language for inclusion in its browser, Netscape Navigator. Originally called LiveScript, the language was named JavaScript on piggyback off the hype surrounding an unrelated language called Java, which had been introduced earlier that year. (When asked the difference between Java and JavaScript, a programmer is likely to quip: “Java is to JavaScript what carpet is to a car.”) To this day, few people think of JavaScript as a specially designed language. , least of all Eich. “I committed to JavaScript in 1995,” he once said, “and I’ve been doing it ever since.”
What was his crime, exactly? You can easily find scripted JavaScript sandbagging blog posts, memes, and Reddit threads, but my favorite is a four-minute talk by software engineer Gary Bernhardt titled “Wat. Imagine, for starters, showing a group of non-English speakers the present and past forms of verbs like passion (passion/cooked) and to chew (to chew/things). So, when you ask them to eatwho can blame them for responding to eat/the food? Similarly, the “what” dialog is a blooper reel of JavaScript’s quirky and unpredictable behavior. Let’s say you want to sort a list of numbers: [50, 100, 1, 10, 9, 5]. Calling the built-in sorting function in any programming language returns a list in numerical order: [1, 5, 9, 10, 50, 100]. Doing so in JavaScript returns [1, 10, 100, 5, 50, 9]Where 10 and 100 are considered greater than 5. why? Because JavaScript interprets each number as a string type and assigns linguistic order, not numeric order. Complete madness.
When Friedman says that JavaScript runs the world, in other words, he means that our world, like the underlying source code, is largely corrupt and incomprehensible. It is like saying, with one breath, that the Universal Declaration of Human Rights would be written in comic sans, given the sorry state of the planet.
At this point, I must admit that while JavaScript is not my favorite language, I love it. Love it, actually. So I can’t help but feel disgusted whenever a certain community of programmers argues against it. Often they focus on flaws that were dealt with years ago. To dwell on JavaScript’s inherent flaws is to ignore the fact that any piece of software—and every programming language is, in essence, a collection of software—is capable of revision and improvement.