const in js |

> In other words, is it ok to assume that the visitors most recent browser update is not earlier than september 2016?

One tool you can use to see what browsers support a specific JavaScript syntax is For example, for const there’s

It looks like const is widely supported by browsers other than IE10 and before. However, it seems to be little gotchas (and potential issues) with many of them if you rely on what makes const great: block scope. If your concern is performance, I’d suggest that you should be fine using var as browsers are good at optimizing code.

If you still were interested in using the new JavaScript constructs that were created after ES6 (const, let, etc) but still wanted to support old browsers, perhaps this guide on how to work with modern JavaScript would be useful.

Thank you. I will stick to var, just to be safe, and believing you with respect to browsers being good at optimizing code.

Source link