Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
61
rated 0 times [  67] [ 6]  / answers: 1 / hits: 15094  / 8 Years ago, thu, august 18, 2016, 12:00:00

I have the problem that this JavaScript snippet runs in Firefox / Chrome without any problem, and Safari I get error: SyntaxError: Unexpected token '>'.



Here's the code:



window.onclick = (test) => {
const googleWindow = window.open();
fakeAjax(response => {
googleWindow.location.replace(`https://google.com?q=${response}`);
});
};

function fakeAjax(callback) {
setTimeout(() => {
callback('example');
}, 1);
}


I've googled and have already seen here in the forum, the problem there appears often, unfortunately I have not found a suitable solution.



Thank you in advance
Best regards


More From » safari

 Answers
4

Arrow function ()=>{} is es6 feature, firefox and chrome both are already supported. But safari old version doesn't. Please check http://kangax.github.io/compat-table/es6/ for more information.


[#61000] Tuesday, August 16, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaredsages

Total Points: 273
Total Questions: 97
Total Answers: 105

Location: French Southern and Antarctic Lands
Member since Fri, Jan 6, 2023
1 Year ago
jaredsages questions
;