Search code examples
javascriptbrowsercross-browserconstantscompatibility

What 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.

What browsers support the const?


Solution

  • 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)