A Story about Type Conversion

When it comes to the equality operator, figuring out how JavaScript handles type conversion can be difficult. Having a better understanding — or at least having a reference to come back to — can have a positive impact on your coding and better prepare you for the mysteries and unintended side effects of type conversion.

This article hopes to be that reference, both for you and myself. Let’s start with some definitions!

Strict equality

Strict equality (, often in other languages) is familiar for most programmers. It checks whether or not two values are identical and of the same type.



During a recent coding challenge, I ran into a SQL query which contained an unfamiliar keyword: DECODE. Perhaps like some of you, I’d never encountered DECODE before. I decided to take some notes, Googling to my heart’s content. Medium didn’t have much of anything on the topic, so I wanted to turn my findings into an article to share with you all.

First, we’ll talk about DECODE, an Oracle-specific SQL function. After learning how DECODE works, we will take a brief look at analogous operators in other database systems (PostgreSQL and MongoDB).


To begin, let’s define the DECODE function in…

Owen Haupt

Software Engineer | JavaScript Enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store