Exploring a Programming Language
As a programmer, it’s important to understand the ins and outs of whatever language and libraries you use. Misunderstanding how the underlying technology behaves is a sure recipe for creating bugs.
In his comically genius “WAT” video,[17] Gary Bernhardt demonstrates how illogical JavaScript and Ruby can be. It’s a fantastic example of exploring programming languages to discover quirks and surprises that can bite the unwary programmer.
Inspired by the video, I decided to explore the JavaScript sort() function. I began with a simple case:
| | ["b", "c", "a"].sort() |
This returned the results I expected:
| | a,b,c |
So far so good. I began brainstorming things I could vary: the count of items in the array (Zero, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access