JavaScript is the Honey Badger of Languages

I’ve finally discovered how to explain JavaScript.

https://medium.com/media/08a7b3ada727c3d0cfa4e081348c7ea0/href

Crazy nastyass JavaScript doesn’t give a shit. Throw anything at it, it’ll handle it. It doesn’t give a shit about assinine compiler errors. It’ll just run the program anyway. So what if it gives the wrong result? At least it gives some result. If the result might be wrong, just throw a test around it using jest, or mocha.

JavaScript testing frameworks don’t give a shit. You can test any convoluted mess with JavaScript. No need for dependency injection gymnastics, or over-generalized interfaces, or reflection magic. Stub, spy, and mock anything with sinon. End-to-end test with webdriverio, or test APIs with my personal favorite lodash-match-pattern 😉

JavaScript is stinky, smelly, and ugly, and it doesn’t care. That’s why you sanitize it with eslint, standardize it, and clean it up with prettier.

Honey badger JavaScript doesn’t care what you see of its guts. There are no private or protected variables. You can inspect and change any object and any function any time you want. Honey badgers don’t hide anything. Why would they? They’re so badass.

JavaScript doesn’t wait. Why would it? Waiting is for plants, not honey badgers. JavaScript won’t wait for a DB access, an API call, or anything else to happen. It has no pity for a missing await keyword and has no guilt about unfulfilled Promises.

You want static types? JavaScript’s got types with TypeScript or Flow. But you ask me it’s kinda like putting water wings on a honey badger. They don’t fit and eventually, they’ll be shredded by “any” type declarations. (Besides who still thinks that “type safety” is actually a thing? 😜)

Honey badgers like to use tools

https://medium.com/media/f4802955e888aa0c6273125504ceb37a/href

…and so does JavaScript.

The NPM package repository has over 800,000 modules at last count — almost 3 times as many as Maven (Java). So what if most of those modules are ugly and as usable as a ball of mud, there’s still enough value there to account for more than 18 billion downloads per month.

Honey badgers will eat just about anything — poisonous snakes, raptor eggs, scorpions, and their favorite — bee larvae. They don’t care what it’s called, to them it’s just “food”. JavaScript will also digest anything, it doesn’t care what it’s called, to JavaScript it’s just “object”. Furthermore, destructuring and spread syntax allow JavaScript to break down objects into the tastiest and nutritious bites.

JavaScript doesn’t care about how it interfaces with other languages: protobufs, swagger definitions, RESTish, graphQL. That’s its job, to take all the shit thrown at it by screwed up APIs and make some sense of it.

JavaScript’s Honey Badger Offspring

Lodash is so badass. If you ever think you need to use a for loop or a while loop in JavaScript, you don’t know Lodash well enough. If you use JavaScript’s native foreach, or map, or filter, you don’t know Lodash well enough. If you ever need to write custom code to do common string manipulation, primitive type checking, or any reshaping collections of objects — you don’t know Lodash well enough.

Look at what momentjs does with dates. It doesn’t care about timezones or savings time or even where you are. It will eat up pretty much any stupid date format, do date arithmetic and poop out the date in the local timezone and local format.

Who the fuck needs an ORM? JavaScript don’t. Relational database tables aren’t natural OOP objects, and pretending they are just creates mental busy work. With knexjs JavaScript avoids DB/Object impedance mismatch, leaky ORM abstractions, and can often skip the redundant OOP model definitions because the SQL data models are just fine the way they are.

Who the hell are you and what are you doing here? The passport module can figure that out.

Forget about your sacred front-end MVC pattern. React (and friends redux, vue, etc.) has permanently destroyed that misapplied, over-generalized dogma.

Then there’s bluebird, axios, babel, and many, many others that make JavaScript the most fearless language on the planet.

JavaScript’s has evolved a thick loose skin over years of use and abuse. It has withstood years of bites and stings from all corners of programming practice. But with 2.3 million yearly pull requests on Github, it doesn’t give a flying fuck what people think of it.


JavaScript is the Honey Badger of Languages was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: