js != vs !== code example

Example 1: != vs !== javascript

(0 ==  '0') // true
(0 === '0') // false

('' ==  0 ) // true, the string will implicitly be converted to an integer
('' === 0 ) // false, no implicit cast is being made

Example 2: == vs === javascript

== Equal to (1 == 1, 1 == "1") // equal in value ("1" is a string)
=== Equal value and equal type (1 === 1 but, 1 !== "1" // not equal type

Example 3: javascript !! vs !

// !! used for checking availability of data 
!!'hello' // true

Tags:

Java Example