equality - When would JavaScript == make more sense than ===? -


As they indicate they are basically the same ' === ' evenly And therefore ' == ' can be converted to type in Douglas Crockford's Javascript: The Good Parts , always' == 'However, I am thinking that what was the basic idea of ​​designing two sets of equality operators.

Have you noticed that using ' == ' is actually more suitable than ' === '?

When you compare numbers or strings:

  (4 === 4) {// true}  

but

  if (4 == "4") {// true}  

and

  if (4 === "4") {// false}  

with these objects -with applies also to the array.

In the above cases, you must make wise choices to use == or ===


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -