Finish JS functional programming