I'd like to declare a function like this:
function calculateArea(length, width) {return length * width;}
using arrow function expression syntax, like this:
function calculateArea(length, width) => length * width;
But doing so causes an error.
1) Can someone explain why JavaScript arrow function syntax can't be used in a function declaration?
2) Are there any nearby alternatives that approximate using an arrow function in a function declaration?
Honestly, it's not a big loss if it can't be done, but I'd like to understand whether there's some deeper reason why this doesn't work, or if this is simply a limitation of the language at present.