You’ve been there. You write a simple console.log('%s', 'user input') to debug a nasty issue. It works perfectly in Chrome. You switch to Firefox or Node, and suddenly, your output is a mangled, recursive mess. You assume Chrome is the sane one. You assume Firefox has a bug. You are wrong.
We don’t write code for machines anymore; we write code for whatever a committee accidentally wrote down a decade ago.
What looks like a bizarre Chromium bug is actually a literal, cold-blooded reading of the WHATWG spec. When a substituted %s value itself contains format specifiers, the V8 engine in Chrome recursively processes them. It doesn’t just substitute the string; it re-evaluates it. Firefox and Node? They just ignore it. They opted for user-friendliness over strict obedience.
This isn’t just a quirky dev trivia fact. It’s an abstraction leak of the highest order. The WHATWG spec mandated a behavior that even its own authors likely never intended. But because Chromium is the dominant engine, its blind, literal compliance accidentally becomes the de facto standard.
Strict compliance produces surprising behavior, making the most obedient browser look the most broken.
The real issue isn’t the code—it’s the absurdity of web specs. A standard can accidentally encode a behavior, and once the 800-pound gorilla implements it, the accident becomes the law. Firefox and Node’s non-compliance isn’t a bug; it’s a direct challenge to spec authority.
For web developers, the message is clear: your console.log is not safe across environments. A log that works in Chrome can recurse unexpectedly or silently differ in Node. Cross-browser testing is treacherous, not because the browsers are failing, but because the rules they follow are fundamentally fractured.
Stop trusting the standard. Start testing the reality.
FAQ
Q: Isn't Chrome just broken if it behaves differently from Node and Firefox?
A: No, Chrome is blindly following the WHATWG spec's literal implications. Firefox and Node chose to ignore the spec's recursive logic to be more user-friendly.
Q: What's the practical implication for developers?
A: You can't trust console.log formatting to behave identically across environments. A %s substitution that works in Chrome might fail or recurse in Node.
Q: What's the contrarian take?
A: Firefox and Node are the real rebels here. Their non-compliance is a feature, not a bug, proving that strict spec adherence often makes for a worse developer experience.