Add shorter ES6 version of @jed’s JS solution

https://twitter.com/mathias/status/493668720842006532