Skip to content

Instantly share code, notes, and snippets.

@adamauckland
Last active March 21, 2017 08:28
Show Gist options
  • Select an option

  • Save adamauckland/746e6dc38fe8c625df8294a63b1fa75d to your computer and use it in GitHub Desktop.

Select an option

Save adamauckland/746e6dc38fe8c625df8294a63b1fa75d to your computer and use it in GitHub Desktop.
Testing renaming classes
class OriginalClass {
constructor () {
console.log(this);
}
}
var originalClass = new OriginalClass();
// outputs:
//
// OriginalClass {}
Object.defineProperty(OriginalClass, 'name', {
value: 'ModifiedClass',
writable: true
});
var a = new OriginalClass();
// outputs:
//
// ModifiedClass {}
@davemackintosh
Copy link
Copy Markdown

Does this mean you can also do new ModifiedClass()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment