Javascript中的"runtime compilation"是什么?

What is "runtime compilation" in Javascript?

我正在阅读有关正则表达式的 this article,上面写着 "Using the constructor function provides runtime compilation of the regular expression"。然后它说 "Use the constructor function when you know the regular expression pattern will be changing"。我想知道的是,Javascript中的运行时编译到底是什么?

这意味着当您使用 /ab+c/; 时,正则表达式会在脚本加载时和使用之前编译,但如果您使用构造函数,它会在该行执行之前编译。

使用构造函数很有用,例如,当您想使用变量构建正则表达式时:new RegExp('ab+' + value);