The Greatest Pun in JavaScript

This article explores the linguistic nature of puns, comparing Shakespearean wordplay to the syntax of JavaScript programming. It specifically highlights how tagged template literals in JavaScript can be used to create clever, pun-like structures in code.
Why it matters
It bridges the gap between humanities and computer science, demonstrating how programming languages share structural properties with natural languages.
Shakespeare’s chock-full of puns, no doubt as a sign of his mastery and love of words.
Rarely can you swap two words to form a correct grammatically sentence, yet he played with words like a magician.
In the example above, the noun “fool” flips to the adjective “foolish”, while the adjective “witty” flips to the noun “wit”. The simplest puns leverage the rules of grammar to change the meaning of words.
Then there are puns that play with phrases in a way that leverages context outside the grammar to change the meaning. Here’s one of my favorites:
Put out the light, and then put out the light.
The first phrase literally means to extinguish a candle, but the second is a metaphor for killing someone (in this case, Desdemona).
The formal dictionary definition of a pun usually talks about the “humorous” effect.
Get smarter about the news
Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.
Create free accountAlready have an account? Sign in