/ Published in: JavaScript

I should've wrote this function a LONGGG time ago.
foreach($myArray, function($k, $v){
console.log($k + " :: " + $v);
});
foreach($myArray, function($k, $v){
console.log($k + " :: " + $v);
});
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function foreach($haystack, $callback){ for(var i in $haystack){ if(typeof($haystack[i]) != 'function'){ $callback(i, $haystack[i]); }; }; };
Comments
