博文

目前显示的是 五月, 2014的博文

"==" vs. "===" in JavaScript

The identity operator "===" behaves the same as equality operator "==", except there is no type conversion is done on it. For "===" the types must be the same to be considered equal. The "===" operator will not do the type conversion, so if two values are not the same,  "===" will simply return false.  The "=="operator will compare for equality after doing any necessary type conversions. They both do type checking,  but "===" doesn't do type conversion after checking, compared to "==" This check may allow === to exit sooner when types are not the same. In general "===" is faster than "==", but sometimes they are the same (If type are the same).