Created
June 28, 2016 14:34
-
-
Save andreasvirkus/508d02f29d16cbb42fda333bb61b4821 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Condensed logical operators | |
var operators = new Function("return {"+ "==,===,!=,!==,<,>,<=,>=" .replace(/([^,]+)/g, "'$1': function (l, r) { return l $1 r; }\n")+ ",'typeof': function (l, r) { return typeof l == r; } }")(); | |
// And beating 'round the bush | |
var operators = { | |
'==': function (l, r) { return l == r; }, | |
'===': function (l, r) { return l === r; }, | |
'!=': function (l, r) { return l != r; }, | |
'!==': function (l, r) { return l !== r; }, | |
'<': function (l, r) { return l < r; }, | |
'>': function (l, r) { return l > r; }, | |
'<=': function (l, r) { return l <= r; }, | |
'>=': function (l, r) { return l >= r; }, | |
'typeof': function (l, r) { return typeof l == r; } | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment