📜  javascript代码示例中的类

📅  最后修改于: 2022-03-11 15:04:23.448000             🧑  作者: Mango

代码示例6
class Support {
    name;
    designation;
    address;
    constructor(name, designation, address) {
        this.name = name;
        this.designation = designation;
        this.address = address;
    }
    startSession() {
        console.log("start a support session");
    }
}

const abraham = new Support("Abraham", "Web developer", "US");
console.log(abraham);
//output:
/* Support {
    name: 'Abraham',
    designation: 'Web developer',
    address: 'US'
  } */