Category: Uncategorized

  • Symbol.toStringTag

    This is a well-known symbol, usually existing on a prototype object. The symbol may be used by Object.prototype.toString calls.

    For example, the class A is written as follows:

    class A {}
    A.prototype[Symbol.toStringTag] = "A";

    Then:

    var a = new A();
    a.toString(); // the result is "[object A]"

    Here a.toString refer to Object.prototype.toString. This internal function return a string in the format “[object ClassName]“. The ClassName can be customized by Symbol.toStringTag of this object.

    The prototypes of the internal objects Map and Set have Symbol.toStringTag property, while others often not. However, Object.prototype.toString method can still set ClassName for these internal types.

  • Hello world!

    Welcome to WordPress. This is your first post. Edit or delete it, then start writing!