1.构造函数模式和Prototype模式


function Cat(name, color) {
    this.name = name;
    this.color = color;
    this.type = "猫科动物";
    this.eat = function() {
        alert("吃老鼠")
    }
}

results matching ""

    No results matching ""