Wednesday, December 7, 2016

jQuery的isEmptyObject()方法

function isEmptyObject(e) {
var t;
for (t in e)
return !1;
return !0
}
......................
return !1 means return false and return !0 - return true.
when you place ! in front the result is evaluated as Boolean and it the opposite is returned.mostly see this in a code passed through google's optimizer. it is mostly done to achieve shortness of the code.
It is often used when boolean result is needed - you may see something like !!(expression). Search in jQuery, for example.

@reference_1
@reference_2

No comments:

Post a Comment