4 ms·
'===' performs better than '==' because no type conversion is need. Are there any reasons you would use '==' instead of '==='?
by 1p1e1 15y ago
'===' performs better than '==' because no type conversion is need. Are there any reasons you would use '==' instead of '==='?
- ryanbraganza 15y agoI can think of two. * (programmer) laziness * if you know you want type coercion
- lucisferre 15y agoAnd I just love me some good old fashioned laziness. I mean seriously THREE equals!?
- zachrose 15y agoWhen you know ahead of time that the types don't need to be coerced: http://jsperf.com/triple-equals-vs-twice-equals/4 http://jsperf.com/triple-equals-vs-twice-equals/4 There's even a negligible performance improvement, at least for me (iPad WebKit Safari).