const regex = /-/g; 在这个修正后的例子中,我们移除了对-的转义,使其作为普通字符被处理。这样就不会触发“unnecessary escape character”错误了。
48-48:Excellent optimization: Replacing regex with direct string operation. The change fromreplaceAlltoreplaceis appropriate here since we're dealing with a literal "0" character. This change improves performance by avoiding unnecessary regex pattern compilation while maintaining identical functionality. Thi...