This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Constructor function | |
// Not to be used as normal function | |
function Person(id, name) { | |
// Was this called using new? | |
if (this == globalThis) | |
throw "Error: use 'new Person()'"; | |
this.id = id; | |
this.name = name; |