Does JavaScript have non-shortcircuiting boolean operators?
问题 In JavaScript (f1() || f2()) won't execute f2 if f1 returns true which is usually a good thing except for when it isn't. Is there a version of || that doesn't short circuit? Something like var or = function(f, g){var a = f(); var b = g(); return a||b;} 回答1: Nope, JavaScript is not like Java and the only logical operators are the short-circuited https://developer.mozilla.org/en/JavaScript/Reference/Operators/Logical_Operators Maybe this could help you: http://cdmckay.org/blog/2010/09/09/eager