gevorg gevorg - 3 months ago 7x
Javascript Question

Do all modern browsers support javascript constants?

I am building javascript application and decided to use 'const' instead of 'var' in my constant definitions something like this:

const MAX_FILE_SIZE = 50;
const MIN_FILE_SIZE = 5;
const MAX_FILE_COUNT = 10;

That makes code more readable to me and I like this, but for some reason my application failed to work on safari.

So is 'const' supported by all modern browsers?


According to the information pages at Can I use and Mozilla Developer Network, the JavaScript const feature is supported in:

  • Google Chrome 20+ (Jun 2012)
  • Mozilla Firefox 13+ (Jun 2012)
  • Microsoft Internet Explorer 11+ (Oct 2013)
  • Opera 12+ (Jun 2012)
  • Safari 5.1+ (Jul 2011)