Hi Chromium devs,
If you don't read/review/author JS code in Chromium you can stop reading now.
Benefit 1: Makes constructing strings easier (shorter and more readable)
Before
let s = 'The time in ' + cityName + ' is ' + time;
After
let s = `The time in ${cityName} is ${time}`;
Benefit 2: Less error prone, less surprising
Before
let a = 1;
let b = 2;
// Oops, probably forgot parentheses, returns 'total is 12' unexpectedly.
let s1 = 'total is ' + a + b;
// Returns 'total is 3'.
let s2 = 'total is ' + (a + b);
After
// Returns 'total is 12', which is less surprising, since no plus sign was used.
let s = `total is ${a}${b}`;
// Returns 'total is 3'
let s = `total is ${a + b}`;
Compatibility:
Support in related environments (Chrome, iOS) looks good, even for Chrome on iOS9, see
Let me know if there are any concerns about this proposal. If there is enough support, I am planning to move forward with this change later this week.
Thank you,
Demetrios