Skip to content

Instantly share code, notes, and snippets.

@jeyziel
Last active October 22, 2017 22:35
Show Gist options
  • Save jeyziel/4f946ba48e592eceeb3622e40198ef03 to your computer and use it in GitHub Desktop.
Save jeyziel/4f946ba48e592eceeb3622e40198ef03 to your computer and use it in GitHub Desktop.
filtrar apenas os números que sejam resultado de uma raíz quadrada onde o radicando seja maior que 20
const pow = ( y ) => ( x ) => Math.pow( x, y )
const square = pow(2)
const isGreatThan = ( y ) => ( x ) => x > y
const isGreatThan20 = isGreatThan(20)
const RadicandoGreatThan20 = ( value ) => isGreatThan20( square( value ) )
const list = [1,2,3,4,5,6,7,8,9,10]
const listFilter = list.filter( RadicandoGreatThan20 )
console.log( listFilter ) //5,6,7,8,9,10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment