Skip to content

Instantly share code, notes, and snippets.

View sakthikanth's full-sized avatar
😍
mongoose

Sakthikanth J sakthikanth

😍
mongoose
View GitHub Profile
@tomoya55
tomoya55 / to_unicode.js
Created September 22, 2012 04:07
Get Unicode Representation of Javascript String
var toUnicode = function(str) {
var hex = str.charCodeAt(0).toString(16).split('');
while(hex.length < 4) hex.splice(0, 0, 0);
return '\"' + '\\u' + hex.join('') + '\"' ;
}
console.log(toUnicode("π"));