Skip to content

Instantly share code, notes, and snippets.

@easierbycode
Created April 29, 2016 20:02
Show Gist options
  • Save easierbycode/31ff830d3f1ca460eeb4e9f82bfb4668 to your computer and use it in GitHub Desktop.
Save easierbycode/31ff830d3f1ca460eeb4e9f82bfb4668 to your computer and use it in GitHub Desktop.
override toString() (Symbol.toStringTag)
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