Skip to content

Comment on Stop Using Constructors in JS (2012)

Comments

Another interesting point of view about constructors:

http://www.2ality.com/2013/07/defending-constructors.html

Awesome, bookmarked like it's 1999.

Seriously though the snippet for the forgetting-new protection in a constructor seems quite handy. It's always good to hear arguments from both sides of the fence.

  > typeof String('abc')
  'string'
  > typeof new String('abc')
  'object'
Oh dear, I think I'm getting a migraine.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.