Results 1 to 2 of 2

Thread: grep alternative in javascript

  1. #1
    Join Date
    Jan 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default grep alternative in javascript

    Hi

    I used grep function of jquery but based on my project requirement i use only javascript so is any alternative of grep in javascript which function i have to use

    plz help me


    Thanks

  2. #2
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    jquery source for grep:
    Code:
    function( elems, callback, inv ) {  
            var ret = [];  
            // Go through the array, only saving the items  
            // that pass the validator function  
            for ( var i = 0, length = elems.length; i < length; i++ ) {  
                if ( !inv !== !callback( elems[ i ], i ) ) {  
                    ret.push( elems[ i ] );  
                }  
            }  
            return ret;  
        }
    Out of curiosity, why can't you use jquery? It's written in javascript.
    Last edited by bernie1227; 01-06-2013 at 02:02 AM.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

Similar Threads

  1. Alternative CSS
    By jhatter in forum CSS
    Replies: 3
    Last Post: 04-29-2010, 09:14 AM
  2. Better Alternative to iFrames?
    By lauranoel in forum HTML
    Replies: 1
    Last Post: 01-20-2010, 06:46 PM
  3. iframe alternative?
    By Jon101 in forum Looking for such a script or service
    Replies: 4
    Last Post: 09-26-2008, 01:47 AM
  4. Alternative to database
    By neo_philiac in forum PHP
    Replies: 1
    Last Post: 08-27-2008, 04:38 PM
  5. Alternative to onload?
    By mvogel in forum Looking for such a script or service
    Replies: 2
    Last Post: 03-30-2008, 03:56 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •