How to declare the constructor in JS inheritance?

problem description

var inherit = (function () {
    var F = function () {}; //
    // function F() {};     //
    return function (Target, Origin) {
        F.prototype = Origin.prototype;
        Target.prototype = new F();
        Target.prototype.contructor = Target;
        Target.prototype.uber = Origin.prototype;
    }
}());

as shown in the note above:

the first is to store a function as a variable;
the second is to declare a constructor directly;
is mainly that both functions can be realized (both can be new objects), but I don"t quite understand the difference between the two ways.
which is better in the current method, why?

Please ask all the big gods and boys to solve their doubts, thank you! Thank you!

May.09,2022

there are many answers to such questions online. Give the landlord a link What is the difference between a function expression vs declaration in JavaScript? , in which you should be able to find the answer you want.


function definition is implemented in 3 ways

new Function('a', 'b', 'return a + b')
function name([param,[, param,[..., param]]]) {
   [statements]
}
let function_expression = function [name]([param1[, param2[, ..., paramN]]]) {
   statements
};

constructor is not commonly used to talk about the difference between function declaration and function expression .
the difference is very simple
function declaration function declaration upgrade you can call the function before declaring the statement, which is understood to mean that the declaration statement is promoted to the top of the execution environment. Declare that the enhanced feature can be solved in es6 module , circular reference
function expression without function declaration promotion , but you can use var,let,const feature
there is no difference in your code

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36c6e-2c04c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36c6e-2c04c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?