Mic*_*ard 7 javascript regex internet-explorer ecmascript-6
我有这段JavaScript代码
price = price.replace(/(.*)\./, x => x.replace(/\./g,'') + '.')
Run Code Online (Sandbox Code Playgroud)
这在Firefox和Chrome中运行良好,但IE =>在我的代码中给出了语法错误.
有没有办法在IE中使用ES6箭头语法?
rob*_*t-s 21
IE不支持ES6,因此您必须坚持使用这些函数的原始编写方式.
price = price.replace(/(.*)\./, function (x) {
return x.replace(/\./g, '') + '.';
});
Run Code Online (Sandbox Code Playgroud)
另外,相关:ES6什么时候可用?
| 归档时间: |
|
| 查看次数: |
15202 次 |
| 最近记录: |