fun with functional programming and js