Why create an inline function instead of const/let declaration

For example, in the code below, why not just declare const WHATEVER = value; since it’s constant and won’t be changed anyway? Learning that in Javascript this is possible, but don’t see the application. Thanks!

const myFunc = () => "value";

1 thought on “Why create an inline function instead of const/let declaration”

  1. Nevermind. I was too impatient. The specific code example might be better off as a simple const declaration, but this sort of syntax can also accept arguments like the code below, which is helpful.

    const myFunc = (name) => "My name is " + name;
    
    myFunc(Derek);
    Reply

Leave a Comment