15.5.3.2 String.fromCharCode([char0[, char1[, ...]]])

2010-07-08

string String.fromCharCode([char0:uint|mixed[, char1:uint|mixed[, ...]]])

Convert given each arguments to (one combined) string. This would be what "chr" does in some/most other languages.

The specification gives no explicit algorithm, but here we go :)

String.fromCharCode.length = 1

Code: (Meta Ecma)
String.fromCharCode = function(){
var n = arguments.length, s = '';
for (var i=0; i var c = arguments[i ];
c = ToUint16(c);
// and now get the character with the unicode codepoint value of c
s += String.fromCharCode(c); // Yes, this is cheating. optionally, we could try a unicode literal here... todo
}
return s;
}