title: Why can I map Boolean and Number but not RegEx?
body: <p>Why can we pass <code>Number</code>, <code>Boolean</code> or <code>String</code> to an Array map but not RegExp? Could be something noob, but just trying to get my head around on the basic difference between these constructors? </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let array = ["10", "20", "30", "40", "0"];
  
  console.log("Boolean",array.map(Boolean));
  
  console.log("Number",array.map(Number));
  
  console.log("RegExp",array.map(x=&gt;new RegExp(x)));
  //cannot do array.map(RegExp)</code></pre>
  </div>
  </div>
  </p>