Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
class Person {
    constructor(n, a) {
        var p = this;
        p.n = n;
        p.a = a;
        p.total = 0;
        p.a.map(x => p.total += parseInt(x)); //get total salary     
    }
    firstName() {
        return this.n = "Min Min ";
    }
    displayMsg() {
        return " and My yearly income is " + this.total;
    }
}
class Employee extends Person {
    constructor(name, age) {
        super(name, age);
        this.name = name;
    }
    lastName() {
        return this.name;
    }
    Show() {
        return "My name is " + super.firstName() + this.lastName() + super.displayMsg();
    }
}
emp = new Employee("David", [123, 456, 754]);
console.log(emp.Show());
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
TimoStapro
0viewers