Skip to content

Instantly share code, notes, and snippets.

@lebbe
Created January 14, 2014 15:59
Show Gist options
  • Save lebbe/8420646 to your computer and use it in GitHub Desktop.
Save lebbe/8420646 to your computer and use it in GitHub Desktop.
Find the UTF8 code points which can be used in variable names in javascript. (PS, this will take some time to complete. Let me know when you are done.)
var hex = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];
var upper = 15;
for(var a = 0;a<=upper;a++) {
for(var b = 0;b<=upper;b++) {
for(var c = 0;c<=upper;c++) {
for(var d = 0;d<=upper;d++) {
try {
window.pre = undefined;
var u = "\\u" + hex[a] + hex [b] + hex[c] + hex[d];
eval("var pre" + u + " = 5;");
eval("var AA = '" + u + "'");
if(window.pre === undefined)
console.log(AA);
} catch (e){
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment