Created
June 7, 2011 14:43
-
-
Save mkuklis/1012380 to your computer and use it in GitHub Desktop.
eq to any in JavaScript
This file contains 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
function eqToAny (el /*, args */) { | |
var args = [].slice.call(arguments, 1); | |
if (args.length == 0) return false; | |
for (var i = 0, l = args.length; i < l; i++) { | |
if (el === args[i]) { | |
return true; | |
} | |
} | |
return false; | |
} | |
var a = 1; | |
var b = 2; | |
var c = 3; | |
var d = 1; | |
console.log(eqToAny(a, b, c, d)); // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment