0

Below code,

function myFunc(theObject) {
   theObject.brand = "Toyota";
 }

adds a member with property name myFunc in window object.

>  window['myFunc']
     function myFunc()

For below code,

class Polygon {
  constructor(height, width) {
    this.height = height;
    this.width = width;
  }
}

How does Polygon get stored in window object?

overexchange
  • 15,768
  • 30
  • 152
  • 347
  • It does get stored not at all. `class` declarations work like `let`, see the duplicate – Bergi Dec 14 '15 at 01:46
  • 4
    @Bergi—"*It does get stored not at all*". Sorry, can't understand that… ;-) – RobG Dec 14 '15 at 01:57
  • You were asking *how* `Polygon` would be stored in `window`. I'm telling you that it doesn't get stored as a property of the global object - it's not a `var` or `function` declaration (and not an undeclared assignment either) – Bergi Dec 14 '15 at 02:32

0 Answers0