Skip to content

Instantly share code, notes, and snippets.

@tarzak
Created December 23, 2014 10:17
Show Gist options
  • Select an option

  • Save tarzak/451c741e8e91df2cf623 to your computer and use it in GitHub Desktop.

Select an option

Save tarzak/451c741e8e91df2cf623 to your computer and use it in GitHub Desktop.
var arr = [1,2,3,4,5,6,7,8];
var lookArr = function(array, callback) {
var i = 0,
len = array.length;
if (typeof callback !== 'function') {
callback = false;
}
for(; i < len; i += 1) {
if(array[i] % 2 === 0) {
console.log(array[i] + ' is even.');
if(callback) {
callback(array[i]);
}
}
}
}
var divideElement = function(element) {
return element / 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment