For some reason, ES6 code that runs well in the current Chrome or Firefox cannot run in Safari - for example, arrow functions. As I know, Safari has ok support for ES6. Is there something that needs to be done?
Example:
var arr = [1,3,5].map((i) => i*i);
console.log(arr);
Or if it is a full .html
file:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
"use strict";
var arr = [1,3,5].map((i) => i*i);
console.log(arr);
</script>
</body>
</html>
Safari (I am using 9.0.3) keeps on giving SyntaxError: Unexpected token '>'
Safari browser version 3.1 to 9.1 doesn't supports. Safari browser version 5 and 5.1 partially suppoprts. Safari browser version 10 to 12 doesn't supports JAVASCRIPT Arrow functions.
ECMAScript 2015 (ES6) is Fully Supported on Safari 15, which means that any user who'd be accessing your page through Safari 15 can see it perfectly.
Arrow functions are introduced in ES6, which provides you a more accurate way to write the functions in JavaScript. They allow us to write smaller function syntax. Arrow functions make your code more readable and structured.
It's a new feature that introduced in ES6 and is called arrow function. The left part denotes the input of a function and the right part the output of that function.
Based on the MDN link, (near the bottom), Safari does not yet support this feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With