Under "don't use new" there is a valid reason to use "new RegExp" -- when inserting variables into your expression, something /()/ can't do.

Also "new Array" has always been pointless, since Array itself returns a new Array, and there's a reason to do that too, when you want a pre-dimensioned array filled with empty elements.

var myArray = Array(15);

console.log(myArray.length); // outputs 15

[] can't do that.

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store