Highr order function javascript [Ar]