| Vector Series - Why You Should Use $.Grep() | |
|---|---|
| Tweet Topic Started: Thursday, 24. November 2011, 11:44 (263 Views) | |
| Andrew | Thursday, 24. November 2011, 11:44 Post #1 |
![]()
ぼくたちがすべてはばか。
|
Why You Should Use $.Grep() Difficulty: Easy Time: 5 Minutes Grep is a handy jQuery function that I don't really seem to see a lot. Due to $.grep()'s lack of usage I decided to make a tutorial about it. $.grep() basically iterates through every element in an array and returns the array with any elements that did or did not match the specifications removed.
yourArray - The array to iterate through. arrayElement - The current element in the array. arrayIndex - The current index in the array. yourTest - Whatever you want to test the current element against. Must return a boolean. invertOrNot - If this is true then an array containing every element that did not pass the specified test is returned instead of one containing every element that did pass the test. Tip: The argument for whether to invert or not is optional. Here's a real world example. Say you had an array filled with test scores and you only wanted the ones that were above 80. Well $.grep() is perfect for this situation.
Have a question? Ask away. |
![]() Professional web design/development services. • http://wildandrewlee.com/ | |
Off
Profile |
Quote Top
|
| Maddy | Thursday, 1. December 2011, 04:29 Post #2 |
![]()
BAMMMMM!
|
Outline Documentations G E N E R A L Documentation accepted in to the General database |
![]() This is a work in progress ^^ "You still talk about it? You still care about it." Tumblr - WeHeartIt - My Things - Twitter The List Life <3
| |
Off
Profile |
Quote Top
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Coding & Development · Next Topic » |
| Track Topic · E-mail Topic |
8:15 PM Jul 10
|
Powered by ZetaBoards Premium · Privacy Policy



Multi
Multi









^




8:15 PM Jul 10


Outline Live