Unexpected use of the reserved word "let" in strict mode

I get an error when testing 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 gives me the error message "Unexpected use of the reserved word" let "in strict mode", but it works when I use Chrome.

+7
javascript safari
source share
1 answer

let not supported on Safari 9 or iOS Safari 9.2:

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

+9
source share

All Articles