0

An ES6 class is a 'syntactic sugar' around the wellknown object-prototype based OOP, AFAIK. Therefore I'd expected to find class definitions in window just before tried this in a browser:

function Foo() {}
Foo.prototype.fooFunction = function() {};

class Bar {
    barFunction(){}
}

console.log(window.Foo); // shows: function Foo() ...
console.log(window.Bar); // shows: undefined !!!

The latter shows undefined instead of function Bar()...

Where is the Bar object/function that represents the Bar class?

Feri
  • 461
  • 4
  • 12

0 Answers0