Return to Snippet

Revision: 35163
at November 3, 2010 13:36 by mattkenefick


Initial Code
function foreach($haystack, $callback){
    for(var i in $haystack){
        if(typeof($haystack[i]) != 'function'){
            $callback(i, $haystack[i]);
        };
    };
};

Initial URL

                                

Initial Description
I should've wrote this function a LONGGG time ago.

foreach($myArray, function($k, $v){
   console.log($k + " :: " + $v);
});

Initial Title
foreach | Javascript

Initial Tags
code, best

Initial Language
JavaScript