Hacker News new | ask | show | jobs
by vgallur 4241 days ago
Another interesting point of view about constructors:

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

2 comments

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.