js 中有时会这么写:
callback && callback();
解释:
t's a shorthand conditional.
If the left of the &&
is truth-y, then whatever is on the right side of the &&
is executed.
This statement says that if callback is defined and truth-y (not null, false, or 0), execute it.
要是callback被定义了,那么执行callback()
http://stackoverflow.com/questions/19120317/what-does-callback-callback-mean-in-javascript