1

What's the difference between these two, and which is more used, more efficient?

class Person {
    constructor(name, age) {
        this.name = name
        this.age = age
    }
}

OR

function Person(name, age) {
    this.name = name
    this.age = age
}
George
  • 6,630
  • 2
  • 29
  • 36
EGK
  • 89
  • 6

0 Answers0