// for browsers if (typeof alert != 'undefined') { print = function () { alert(Array.prototype.slice.call(arguments).join(' ')); } } // for jshost (jslibs) else if (typeof LoadModule != 'undefined') { LoadModule('jsstd'); print = function () { Print(Array.prototype.join.call(arguments, ' '), '\n'); } } // for DMDScript else if (typeof ScriptEngine == 'function' && ScriptEngine() == 'DMDScript') { _print = print; print = function () { _print(Array.prototype.join.call(arguments, ' '), '\n'); } } a = function () { function A(x) { function B() { return x * x; } return B; } var b1 = A(1); var b2 = A(2); print('b1() =', b1(), "\n"); print('b2() =', b2(), "\n"); print('b1', b1 == b2 ? '==' : '!=', 'b2', "\n"); } a.call();