January 2008

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

JavaScript
vbscript

Comments (6)

Permalink

FBJS-Like test console

FBJS really did the right simple thing to put JavaScript into sandbox, and here’s my raw prototype:

http://www.hedgerwow.com/360/dhtml/fbjs/demo.php

JavaScript
FBJS
Facebook

Comments (7)

Permalink