In defense of a much-mocked programming language.
Lex Fridman has done many long interviews on his popular podcast. Even so, the episode with the legendary programmer John Carmack has an unhinged director’s-cut feel to it. Over five hours, Carmack dishes on everything from vector operations to Doom.
But it’s something Fridman says, offhand, that really justifies the extended run time: “I think that if we’re living in a simulation, it’s written in JavaScript.” To review: JavaScript is what makes static web pages “dynamic.” Without it, the internet would resemble nothing so much as an after-hours arcade, lifeless and dark. These days, the language is used in both front- and backend development for a whole host of mobile platforms and apps, including Slack and Discord. And the main thing to understand about it, in the context of Fridman’s nerdy koan, is this: For any self-respecting programmer, admitting to actually liking JavaScript is something of a faux pas—much like an art-house filmmaker confessing to Marvel fandom. I suppose this has something to do with the fact that JavaScript was created in less time than it takes to home-brew a jar of kombucha: 10 days. In 1995, Netscape hired a programmer named Brendan Eich to create a language to embed in its browser, Netscape Navigator. Originally called LiveScript, the language was renamed JavaScript to piggyback on the hype around an unrelated language called Java, which had been introduced earlier that year. To this day, few people consider JavaScript a particularly well-designed language, least of all Eich. “I perpetrated JavaScript in 1995,” he once said, “and I’ve been making up for it ever since.” What was his crime, exactly? You can easily find scads of blog posts, memes, and Reddit threads sandbagging JavaScript, 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 boil and chew . Then, when you ask them for the conjugation of eat, who could blame them for answering eat/eated? Similarly, the “Wat” talk is a blooper reel of JavaScript’s quirks and unpredictable behaviors. Let’s say you want to sort a list of numbers: . Calling the built-in sort function in any sane language returns the list in numerically ascending order: . Doing so in JavaScript returns , where 10 and 100 are considered larger than 5. Why? Because JavaScript interprets each number as a string type and does lexical sorting, not numerical sorting. Total insanity. When Fridman says JavaScript runs the world, in other words, what he means is that our world is, like the underlying source code, massively screwed up and incomprehensible. It’s the equivalent of pronouncing, with a sigh, that considering the sorry state of the planet, the Universal Declaration of Human Rights must have been written in Comic Sans. One of the principal criticisms of JavaScript is that it’s slow. This holds some truth in a general sense, but saying one language is “slower” than another is, technically speaking, an ill-formed objection. The performance of a language depends not only on the language itself but also on the caliber of its run-time environment—the setting in which the code is executed—and its compiler, which translates source code into a machine-readable format. Put differently, uncompiled code is akin to an uncast magic spell. Much as the potency of a spell depends on the caster, languages deemed “faster” but executed with crappy compilers could perform not much better than “slow” languages. What’s more, JavaScript was, in a sense, bailed out of its terribleness by colossal advancements in software engineering and industry-wide efforts. Carmack acknowledges this in the same podcast: “The systems that make JavaScript run as fast as it does right now are kind of miracles of modern engineering in many ways.” A prime example is the Google Chrome team’s V8 JavaScript engine, which compiles JavaScript “just in time,” significantly boosting its performance. If there were an equation to calculate the overall utility of a programming language, I’d bet the vibrancy of the language’s ecosystem would be an exponential variable that dominates the other linear terms. This is to say, no well-designed language is useful on its own without useful libraries. But when backed by a healthy community of developers, as is the case with JavaScript, even a modest language becomes supremely effective. JavaScript is also an easy language, and by that I don’t imply any insult. Learnability is a killer feature. JavaScript has undergone multiple iterations. The development of the language is steered by the rather unremarkably named Technical Committee 39 under a Geneva-based standards organization called Ecma International. While some languages are governed by a conclave of experts, the process for JavaScript provides more visibility. Proposals and meeting notes are publicly available on GitHub. Meetings, once routinely held in the San Francisco Bay Area, have expanded to other places such as Bergen, Galicia, and Tokyo, as if to resist the notion that the tech industry can be metonymized by Silicon Valley. In some ways, JavaScript is the people’s programming language: egoless and all-embracing. According to the annual Stack Overflow Developer Survey—as close to a global census of the industry as there is—2023 marked the 11th consecutive year that JavaScript has been the most commonly used language. Let’s be clear: I’m not trying to deny that vanilla JavaScript can be hacky. I am, however, trying to argue that there’s nothing fraudulent or even disagreeable about its ubiquity. In an industry that prides itself on the hacker ethos, calling JavaScript hacky may even be an honorific. So an apology is in order, I think—and a congratulations. Look how far you’ve come, JavaScript, hopscotching across different eras of the internet, rising from a laughingstock to the lingua franca of the web. Well done, you ridiculous language. If I am being simulated by you, so be it.
Trending
A gorgeous April afternoon in store across the Denver metro area
‘Artemis Mission Cannot Lead To Interplanetary Wild West,’ Astronomer Warns
Trump says US forces will ‘finish the job’ soon in first prime-time speech since starting Iran war
Former Wisconsin football player, who left the sport amid mental health struggles, dead at 24
Drew McIntyre Gives Honest Take About His Recent WWE Title Reign
U.S. Sen. Bernie Sanders introduces bill that could keep the Padres in San Diego United States Latest News, United States Headlines
Similar News:You can also read news stories similar to this one that we have collected from other news sources.
Late-season magic runs out for Houston Academy girls with loss to Cottage HillHouston Academy’s remarkable late-season run came to an end Friday with a 40-24 loss to Cottage Hill Christian in the Class 3A girls South Regional semifinals at Garrett Coliseum.
Read more »
Mom Runs Marathon to Cope With Double Mastectomy, HysterectomyStephanie Thurrott is a writer who covers mental health, personal growth, wellness, family, food and personal finance, and dabbles in just about any other topic that grabs her attention. When she's not writing, look for her out walking her dog or riding her bike in Pennsylvania's Lehigh Valley.
Read more »
Stolen big rig goes up in flames as suspect runs away from police during pursuitA stolen big rig led officers on a cross-county pursuit before bursting into flames near Rancho Cucamonga.
Read more »
1 car, 2 hit-and-runs; Seattle Police investigate after 2 people struck on the sidewalksSeattle Police say one car is likely responsible for running two hit-and-runs over two people who thought they were safe on the sidewalk.
Read more »
White House, tribal leaders hail 'historic' deal to restore salmon runs in PNW regionThe plan, announced in December, stopped short of calling for the removal of four controversial dams on the Snake River.
Read more »
Ditching Distractions (Even Music) During My Runs Cleared My Mind and Made Me a Better RunnerDiscover how ditching distractions (yes, even music) can make you a better runner and help you get the most out of the experience.
Read more »
