Created
April 29, 2016 20:02
-
-
Save easierbycode/31ff830d3f1ca460eeb4e9f82bfb4668 to your computer and use it in GitHub Desktop.
override toString() (Symbol.toStringTag)
This file contains hidden or 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
class Blog { | |
} | |
let b = new Blog() | |
console.log( blog.toString() ); | |
// [object Object] | |
Blog.prototype[Symbol.toStringTag] = 'My Awesome Blog Class'; | |
blog.toString() | |
// "[object My Awesome Blog Class]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment