Skip to content

Instantly share code, notes, and snippets.

@nrm176
Created September 13, 2015 06:56
Show Gist options
  • Save nrm176/3e8ec314cfad580aa00e to your computer and use it in GitHub Desktop.
Save nrm176/3e8ec314cfad580aa00e to your computer and use it in GitHub Desktop.
Filter numbers larger than or equal to 4 and square them
var m = [1,2,3,4,5].filter(function(e){
if (e>=4){
return e
}
}).map(function(e){
return e*e;
});
console.log(m)
//[ 16, 25 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment