You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because there are restrictions on the low-level of JS, if the instance isn’t constructed by `Date` , it can’t call the function in `Date`, which also explains on the side: `Class` inheritance in ES6 is different from the general inheritance in ES5 syntax.
291
+
292
+
Since the low-level of JS limits that the instance must be constructed by `Date` , we can try another way to implement inheritance.
The Implement ideas of the above inheritance: firstly create the instance of parent class => change the original `__proto__` of the instance, connect it to the `prototype` of child class => change the `__proto__` of child class’s `prototype` to the `prototype` of parent class.
307
+
308
+
The inheritance implement with the above method can perfectly solve the restriction on low-level of JS.
309
+
310
+
248
311
#### Promise implementation
249
312
250
313
`Promise` is a new syntax introduced by ES6, which resolves the problem of callback hell.
0 commit comments