One reason this may be useful is because it prevents hoisting. A second reason is that you could conditionally assign a function to a variable for use later. A third, though not as common today, is it allows you to extend a function by adding more functions to its prototype. You rarely see this today because we have classes. But that’s how we’d fake classes years ago.
2
u/n8rzz Apr 15 '24
Why do you say that? Genuinely curious.