Filter Exercises

A filter takes a list and returns a smaller list based on a predicate function.

1. Show only even numbers

const numbers = [1,2,3,4,5,6,7,8,9,10]

2. Show only numbers divisible by 5

const numbers = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]

3. Filter all buzzwords that contains cloud, html, and data

const h = require('hyperscript')

const buzzwords = require('buzzwords')

const li = (w) => h('li', w)

console.log(h('ul', __ ))

Index