Created
September 13, 2015 06:56
-
-
Save nrm176/3e8ec314cfad580aa00e to your computer and use it in GitHub Desktop.
Filter numbers larger than or equal to 4 and square them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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