Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
68 views
in Technique[技术] by (71.8m points)

javascript - Not all objects inherit from Object instance?

I remember in ES5, it was said that all objects inherit from Object. (formally, I think it is "inherit from Object.prototype")

But in ES6, if I have the following code:

class Dog {
  constructor() {
    super();    // will cause an error
  }
  
}

const woofie = new Dog();
question from:https://stackoverflow.com/questions/65938931/not-all-objects-inherit-from-object-instance

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...