That Elixir part is pretty slick. But to be fair to JS, you could also write that JS function like this:

  let factorial = n => n === 0 
         ? 1
         : factorial(n - 1) * n;
But I do wish JavaScript had some more powerful pattern-matching syntax. For example, both Rust and C# both have nice switch/match expressions that can really simplify code like this.