What distinguishes the three distinct ways to declare functions in JavaScript?

I have come across three unique methods to define functions in JavaScript and, while I understand that they differ in subtle ways, I remain uncertain about the specific benefits of each approach and the need for all of them. Here is a sample demonstrating alternative syntax choices:

function Widget() {
    function internalMethod() {
        console.log('Executing internalMethod');
    }

    this.trigger = function() {
        console.log('Executing trigger');
    };

    let hiddenAction = function() {
        console.log('Executing hiddenAction');
    };
}

I would appreciate further clarification on why JavaScript offers these various options and in what scenarios each type might be most beneficial.

hey, i think its about hoisting and scoping. func declerations get hoisted while exprexsions give more control device. pick type based upon when and where you want the function to be avilable

In my experience, the choice between these function types is largely about context and control. Named declarations are often preferable for their clarity during debugging and their hoisting behavior, which makes them accessible before their definition in the code flow. Conversely, using function expressions, whether stored in a variable or passed immediately, offers more precise control over when the function exists, which can be beneficial in modularized code. Arrow functions are particularly useful when you need to retain the lexical context of ‘this’, simplifying state management in callbacks and methods.