Search code examples
javascriptsafariecmascript-6let

Does Safari have issues with ES6 keyword 'let'?


I've written a web application with esversion: 6 which works in all browsers (even Edge works!) except Safari 9.

A simple JavaScript snippet like:

let m;

Causes errors like this:

SyntaxError: Unexpected identifier 'm'

Now, I see Safari is based on Webkit and it should fully support ES6 by now. What's the issue here?


Solution

  • Try this link: Let Keyword Browser Compatibilities

    As you see in the link, Safari (9 and lower) is not supported fully by JavaScript ES6 let keyword, despite webkit. But try using safari 10. Say, are you using "use strict"? If you are then that might be the problem.