Javascript array member tests


/ Published in: JavaScript
Save to your folder(s)

Given:
`a=['1',2,6];`

Allows things like:
`
a.contains(2); //true
'1'.in(a);
(1).in(a,true); //type not identical, so false
(1).in(a); //no type check, so true
`

I never actually used this, it was more of an exercise in playing with JS.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.