'is equal to': == vs ===

Hi all,

I come from Processing where ‘is equal to’ is represented by ‘==’. Lauren McCarthy’s book “Getting Started with Processing” uses this standard as well. However I’ve noted that here:
https://p5js.org/examples/control-conditionals-1.html
they show ‘===’ for ‘is equal to’. Is this an updated standard? Is there a difference between the two?

Thanks!

1 Like

It’s not an updated standard, but rather a more specified type of check.

== checks whether values are the same, while === also checks whether the variable types are the same. The first example on the article JavaScript – Equality (==) vs. Identity (===) Operators should give you a pretty good idea of how it works.

3 Likes

Amazing-- thanks so much for your response :slight_smile: Extremely helpful!