Why would you use an arrow function declare it to a variable rather just use keyword function it makes no sense just harder to read
It will make sense, when you complete the JavaScript course.
most time it’s indifferent if you use one or the other, and since arrow functions have been added to JavaScript, it’s often more common to see arrow functions than function definitions, as coders tend to like more compact code.
When you write your code you are free to use one or the other, unless it’s specifically required.
how is const myArrowFunction = () => {}
more compact than
function myFunction()
{
}
Im assuming you mean space wise and not character wise? Also isn’t the end goal maintability?
do you think that arrow functions are less maintenable?
the compactness is seen more with anonymous functions, and probably the preference carry on
If it’s harder to read, then yes, it’s less maintenable.
it doesn’t seem that it is generally found less readable, but there are always personal preferences