call apply 都是为了改变this得指向

    1. function Compute() {
    2. this.plus = function (a, b) {
    3. console.log(a + b);
    4. }
    5. this.minus = function* (a, b) {
    6. console.log(a - b);
    7. }
    8. }
    9. function FullComputed() {
    10. Compute.apply(this)
    11. this.mul = function (a, b) {
    12. console.log(a * b);
    13. }
    14. this.div = function (a, b) {
    15. console.log(a / b);
    16. }
    17. }
    18. let computed = new FullComputed()
    19. computed.plus(1, 2)