I have a class like this
"use strict";
class Person {
constructor(x, y) {
this.x = x;
this.y = y;
}
}
And I'd like to create a Person
using window like this:
var bob = new window["Person"](0, 15);
Like done here: Instantiate a JavaScript Object Using a String to Define the Class Name
or here: Create object from string
But it's not working. I get the error:Uncaught TypeError: window.Person is not a function
Is this not possible or am I making a stupid mistake?