Javascript examples for Object:Constructor
Create object from string in JavaScript ECMAScript 6
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w .j ava 2s . c om*/ "use strict"; class Person { constructor(x, y) { this.x = x; this.y = y; } } window.classes = {}; window.classes.Person = Person; document.body.innerText = JSON.stringify(new window.classes["Person"](1, 2)); } </script> </head> <body> </body> </html>