sweet-js / sweet-core

Sweeten your JavaScript.
https://www.sweetjs.org
BSD 2-Clause "Simplified" License
4.58k stars 208 forks source link

Use var instead of const to handle all browsers with helpers #676

Closed disnet closed 7 years ago

disnet commented 7 years ago

Even modern browsers like Safari 10 apparently have problems with const in eval so just don't use ES2015 features.

The minimal repro for those interested. Throws a reference error in safari 10 (and tech preview). Same in recent-ish chrome too I think.

eval(`
const a = 1; 
function f() {
 console.log(a); 
}; 
f()');