When I research online, I'm finding different answers.
class Foo {
    constructor() {
        this.data = [];
    }
    add(x) {
        //
    }
}
Is the above code equivalent to Code A or Code B?
Code A:
function Foo() {
    this.data = [],
    this.add = function(x) {
        //
    }
}
Code B:
function Foo() {
    this.data = []
}
Foo.prototype.add = function(x) {
    //
}
 
     
    