Smart pascal source code
var i := 131072;
var s := Chr(i);
WriteLn(Ord(s));
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
131072
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}
function Chr(c) {
if (c<=0xFFFF)
return String.fromCharCode(c);
c-=0x10000;
return String.fromCharCode(0xD800+(c>>10))+String.fromCharCode(0xDC00+(c&0x3FF));
}
// inspired from
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/charCodeAt
function $uniCharCodeAt(str, idx) {
var c = str.charCodeAt(idx);
if (0xD800 <= c && c <= 0xDBFF) { // High surrogate
var lo = str.charCodeAt(idx+1);
if (isNaN(lo)) return c;
return ((c - 0xD800) * 0x400) + (lo - 0xDC00) + 0x10000;
}
if (0xDC00 <= c && c <= 0xDFFF) { // Low surrogate
return -1;
}
return c;
}function $OrdS(s) { return (s.length>0)?$uniCharCodeAt(s,0):0 }
function WriteLn(value) {
if (window.console) { window.console.log(value); } };
var i = 0,
s = "";
/* <<< main JS >>> */
i = 131072;
s = Chr(i);
WriteLn($OrdS(s));