Those are two completely different animals though. I am looking for something like:
isIn(5, [1, 3, 4]) -> false isIn(3, [1, 3, 4]) -> true Maybe since JS has two types of equality, there could be an "isIn" and "isInExact" function. We could also allow iterators instead of arrays. It would leave the iterators in an undefined state since it wouldn't have to iterate through all the elements. On Tuesday 10 January 2006 14:50, Beau Hartshorne wrote: > JavaScript does have an "in" operator. > > "The in operator expects a lefthand operand that is or can be > converted to a string. It expects a righthand operand that is an > object (or array). It evaluates to true if the lefthand value is the > name of a property of the righthand object. For example: > > var point = { x:1, y:1 }; > var has_x_coord = "x" in point; // Evaluates to true" > > (From JavaScript, The Definitive Guide, page 67.) > > > In python we have the handy "in" operator: > > > > if 3 in [1,2,3]: ... > > > > Is there a similar function in MochiKit? I looked around and couldn't > > see one, so I wrote on myself. >