1.

class Rect {
constructor(h, w) {
this.height = h;
this.width = w;
}
get foo() {
return this.foo();
}
foo() {
return this.height * this.width;
}
}

const sq = new Rect(5, 20);
console.log(sq.foo());
2.Choose the correct syntax in order to access property of the object created?

A. ticket.from & ticket[to]
B. ticket[to] & ticket[from]
C. ticket {to} & ticket.to
D. ticket[to] & ticket{from}
Answer» B. ticket[to] & ticket[from]


Discussion

No Comment Found

Related MCQs