Skip to content

Instantly share code, notes, and snippets.

@jw56578
Created November 15, 2017 17:12
Show Gist options
  • Save jw56578/bdcd21244aa8df279170bed9594d6934 to your computer and use it in GitHub Desktop.
Save jw56578/bdcd21244aa8df279170bed9594d6934 to your computer and use it in GitHub Desktop.
debugger example
debugger;
const names = ["Jon","Bob","Ted","Barney","Lilly","Robin","Saul","Axe"];
const myNumbers = [4,3,55,22,99,1913,7,5,4,2,1];
function findThree(name){
return name.length === 3;
}
function filter(theArray, fnc){
let newArr = [];
for (let i = 0; i < theArray.length; i++) {
if(fnc(theArray[i])) {
newArr.push(theArray[i]);
}
}
return newArr;
}
let result = filter(names,findThree);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment