functional programming javascript examples