Does anyone know how to write an immediate function using ES6 arrow syntax?
Here's the ES3/5 way of doing it:
(function () {
//...
}());
I've tried the following but get an unexpected token
error on the last line.
(() => {
//...
}());
You can test this here: http://www.es6fiddle.net/hsb8bgu4/
From the Arrow functions examples,
(() => "foobar")() // returns "foobar"
So, the function invocation operator should be outside.
(() => {
//...
})();