Like a lots of things in JS, you can screw yourself if you're not careful with the flexible syntaxe.
ESlint (with airBnB rules) can help a lot with this. As you said, there's two (maybe three) ways to use arrow-functions. Here's the two syntaxes I enforce to myself.
1 Simple one-liner:
this.children.forEach(child=>child.remove());// Without implicit returnconsttranslated=points.map(point=>point.add(x,y));// With implicit return
Like a lots of things in JS, you can screw yourself if you're not careful with the flexible syntaxe.
ESlint (with airBnB rules) can help a lot with this. As you said, there's two (maybe three) ways to use arrow-functions. Here's the two syntaxes I enforce to myself.
1 Simple one-liner:
1.1 Object return:
2 Multi-line operation: