Syntactically the same as not having them, aside from the fiddly details of string vs property name access to an object.
thisObject = {
usualPropertyName: value1,
'property name with spaces': value2
}
thisObject.usualPropertyName
thisObject['usualPropertyName'] // this works too
thisObject['property name with spaces'] // you can't use the dot access style with this property name
> Why are some normal functions and others fat arrow functions?Fat arrow functions bind "this" to whatever the surrounding context is, and if the only statement is a single object or value, it implicitly returns that.
That is to say, this:
whatever => value
is syntactically the same as this: whatever => (
value
)
is syntactically the same as this: whatever => {
return value
}
> Why omit the parens around the param of a one parameter fat arrow function -- does that define a get accessor?If there's only a single argument, you don't need the parentheses. This is meant mostly for the convenience of things like this:
someArray.map(item => item.propertyName)