Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    Any custom made object with the constructor name "Date" returns "Date" too which is as risky as just checking if the parameter has getMonth property. Commented Jun 27, 2017 at 16:11
  • 3
    @boghyon sounds like whomever creates an object with the constructor name of a already predefined Javascript standard library is not following best practices in the first place. That would be like downloading lodash then creating your own lodash module and expecting things to work. Commented Jun 28, 2017 at 13:59
  • note that if the value is null then value.constructor.name throws an exception. Commented Aug 31, 2021 at 6:11