JavaScript equal, double equal, triple equal

How does =, ==, and === differ in JavaScript?

= is for assignment

var a = 50       // int
var b = "50"    // string

== is for equality test

a == b    // returns true

=== tests equality of type and value It will convert int to string and the value will be true

a === b     // returns false

This will not cast type. So 50 is not equal to "50".

Technologies: