Class Inherit

    0

    0

    My JavaScript recipes

    Class that inherit another class

    class ParentClass {
      constructor(x, y) {}
    }
    class ChilClass extends ParentClass {
      constructor(x, y) {
        super(x, y);
      }
      move(dx, dy) {
        this.x += dx;
        this.y += dy;
      }
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.