The inheritance mode of js call, why is it possible to delete call only through new?

    function Base() {
        this.name="name"
        this.age=18
    }
    Base.prototype={
        say() {
            alert("hi")
        },
        ex:"lucy"
    }
    function Student() {
        Base.call(this,arguments)//////  
        this.add="US"
    }
    Student.prototype=new Base()//call
    
    let tom=new Student()
    tom.say()
Mar.22,2021

remove the following code

Base.call(this,arguments)//////  

with or without the above code, the content of the variable tom is different. I don't know if you found out.
essentially, if you don't write this line of code, the base constructor won't execute, and if you don't need the logic of the parent constructor, that's fine.
but I bet you need it.

I hope my answer will be helpful to you. My personal homepage is https://azl397985856.github.io/, and the Nuggets homepage https://juejin.im/user/58af98.


Base.call(this,arguments)

this sentence executes the constructor of the parent class, which is equivalent to super ()

in class .

inheritance of

JS there are many kinds of prototype object inheritance and modified constructor inheritance,

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-1b3b32f-2c268.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-1b3b32f-2c268.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?