Why does the substring() method in JavaScript do magic “argument swapping”?

It's existed since the original JavaScript 1.0 from Netscape (as rev-engineered by Microsoft). Netscape 4 briefly removed the behaviour with JavaScript 1.2 in June 1997.

But... that same month the misfeature completed standardisation as part of ECMAScript 1.

Thus, it returned with the release of Netscape 4.5 in 1998, and been with us ever since!

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!