Define JavaScript Constant for Firefox, Internet Explorer and Safari

I tried to do something across browsers like this :

const FOO = ‘bar’;

(function(){

alert( ‘before >> ‘ + FOO  ); //expected -> bar
FOO = ‘Opera 9.5 sucks’;
alert( ‘after >> ‘ +FOO  ); //expected -> bar, but Opera 9.5 will fail me.

})();

It seems that declaring a constant in IE is a lot easier than other browsers for me.


http://www.hedgerwow.com/360/dhtml/js_constant.html