Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected use of reserved word 'let' in strict mode

I'm getting an error when I test the following code in Safari.

var temp_color = null;
    var temp = 0;
    var tempv = 0;
    for (let x in colorblock) {
        temp_color = colorblock;
        tempv = Math.pow((color.r - temp_color.r), 2) + Math.pow((color.g - temp_color.g), 2) + Math.pow((color.b - temp_color.b), 2);
        if (x === 0) {
            temp = tempv;

Safari throws the error "Unexpected use of reserved word 'let' in strict mode" but it does work when I use Chrome.

like image 382
吴天哲 Avatar asked Jan 06 '16 15:01

吴天哲


1 Answers

let is not supported in Safari 9 or iOS Safari 9.2:

http://caniuse.com/#search=let

like image 110
Ben Cook Avatar answered Oct 24 '22 07:10

Ben Cook