What is the difference between below methods in comparing a string with undefined value.
Why should i prefer second method in this case.. Please let me know advantages..
==attempts to convert the values to the same type before testing if they're the same.
"5" == 5
"5" !== 5
In this case, the result is:
x == undefinedwill be true if
x === undefinedwill only be true if
You should prefer the first method if you'd like undefined and null to be treated equivalently.