How to write Javascript like Elixir