As @DrAzzy says, looks like that's probably not 'real' JavaScript, but is calling into internal V8 functions...
As there's no unicode it's simplified quite a bit - you could probably get away with:
function encodeURIComponent(s) {
var ok = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
var r = "";
for (var i=0;i<s.length;i++) {
if (ok.indexOf(s[i])>=0) r+=s[i];
else r+= "%"+(256+s.charCodeAt(i)).toString(16).substr(-2);
}
return r;
}
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
As @DrAzzy says, looks like that's probably not 'real' JavaScript, but is calling into internal V8 functions...
As there's no unicode it's simplified quite a bit - you could probably get away with: