Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
13
rated 0 times [  18] [ 5]  / answers: 1 / hits: 22908  / 8 Years ago, tue, october 18, 2016, 12:00:00

I have this piece of JavaScript code



price = price.replace(/(.*)./, x => x.replace(/./g,'') + '.')


This works fine in Firefox and Chrome, however IE gives me an syntax error pointing at => in my code.



Is there a way to use ES6 arrow syntax in IE?


More From » regex

 Answers
9

IE doesn't support ES6, so you'll have to stick with the original way of writing functions like these.



price = price.replace(/(.*)./, function (x) {
return x.replace(/./g, '') + '.';
});


Also, related: When will ES6 be available in IE?


[#60352] Sunday, October 16, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aubreeg

Total Points: 437
Total Questions: 102
Total Answers: 102

Location: Colombia
Member since Mon, May 2, 2022
2 Years ago
;