My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
contains  
Overview of contains
Updated Apr 30, 2010 by matr...@mac.com

contains

Action that checks if one thing contains another.

Usage

(boolean) objx( object ).contains(check [, behaviour]);

object The object to check
check The object to look for (inside object)
behaviour See actions

Arrays

The most common use of contains is to check to see if an array contains a specific item.

objx([1,2,3,4,5]).contains(3);
// returns true

objx([1,2,3,4,5]).contains(6);
// returns false

Strings

You can check to see if one string contains another.

objx("Hello world!").contains("world");
// returns true

objx("Hello world!").contains("monkey");
// returns false

Numbers

You can check to see if a number is contained within another (i.e. is it equal to or less than the value?)

objx(10).contains(1);
// return true

objx(10).contains(11);
// returns false

Sign in to add a comment
Powered by Google Project Hosting