title: What does Regex.compile do in Ruby?
body: <p>Specifically, my code is:</p>
  
  <pre><code>START_SINGLE_LINE_COMMENT =  Regexp.compile(SINGLE_LINE_COMMENTS.map { |c|
        "\s*#{Regexp.escape(c)} "
      }.join("|"))
  </code></pre>
  
  <p>What does this actually do?</p>
  
  <p>Ideally, what would the JS equivalent be?</p>