Back

JSBits #4: Comparison operator

Captain's log, stardate d71.y38/AB

Javascript ES6 Development
-
Full-stack developer
JSBits #4: Comparison operator

Here's another JavaScript bits we wanted to share with you. Let's talk about the comparison operator, today!

Just in case you don't know it, JavaScript has two different operators to compare primitives (neither of them works with objects, though). One is == (equality) and the other is === (identity).

If you have to know only one thing is don't use == never, ever. There's always a better, safer and more performant alternative using ===.

If you want to learn more, read this StackOverflow entry.

Share this post

Related Articles

JSBits #0: an introduction to JavaScript modules

JSBits #0: an introduction to JavaScript modules

We have been accumulating a lot of knowledge in JavaScript over the years that we want to share with you in frequent bits, so we'll call this JavaScript Bits!

Read full article
JSBits #2: Return more than one value

JSBits #2: Return more than one value

Here's another JavaScript bits we wanted to share with you. Small tips and tricks for JavaScript developers for all levels. This time around, we share how to return more than one value.

Read full article
JSBits #5: Loop statements: 'for..in' vs 'for..of'

JSBits #5: Loop statements: 'for..in' vs 'for..of'

Here's another JavaScript bits we wanted to share with you. Let's talk about the loop statements, today.

Read full article