From the Arrow functions examples,
(() => "foobar")() // returns "foobar"
So, the function invocation operator should be outside.
(() => {
//...
})();
More Related Contents:
- JavaScript ES6: Test for arrow function, built-in function, regular function?
- When should I use arrow functions in ECMAScript 6?
- Why can I not use `new` with an arrow function in JavaScript/ES6?
- Are ‘Arrow Functions’ and ‘Functions’ equivalent / interchangeable?
- What’s the meaning of “=>” (an arrow formed from equals & greater than) in JavaScript?
- What does “this” refer to in arrow functions in ES6?
- What do multiple arrow functions mean in JavaScript?
- Why doesn’t my arrow function return a value?
- Arrow function without curly braces
- How do I write a named arrow function in ES2015?
- What are the differences (if any) between ES6 arrow functions and functions bound with Function.prototype.bind?
- Arrow Functions and This [duplicate]
- Can you bind ‘this’ in an arrow function?
- How does this object method definition work without the “function” keyword?
- Using _ (underscore) variable with arrow functions in ES6/Typescript
- How to extend Function with ES6 classes?
- Proper use of const for defining functions
- How can I clone a JavaScript object except for one key?
- Is there a mechanism to loop x times in ES6 (ECMAScript 6) without mutable variables?
- Can I use arrow function in constructor of a react component?
- ESCMAScript 6 arrow functions – parentheses around parameter
- Function parameter definitions in ES6
- ES6 functions, arrow functions and ‘this’ in an ES6 class [duplicate]
- What can we do with ES6 Generator that we cannot with for loop?
- Why is `throw` invalid in an ES6 arrow function?
- Is it possible to reset an ECMAScript 6 generator to its initial state?
- functional way to iterate over range (ES6/7) [duplicate]
- Is it possible to export Arrow functions in ES6/7?
- user defined object equality for a set in harmony (es6)
- $(‘elems’).each() with fat arrow