Skip to content
RED SAG Skills
hard20 pts · first answer countsjavascriptclassesjson

Class getter and hasOwnProperty

What does this print?

class Item {
  constructor(p) { this.price = p }
  get withGst() { return this.price * 1.18 }
}
const i = new Item(100)
console.log(Object.hasOwn(i, "withGst"), JSON.stringify(i))
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions