Created
February 21, 2013 02:02
-
-
Save romeoh/5001342 to your computer and use it in GitHub Desktop.
toHex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onInitPage(){ | |
console.log(toHex('김')) | |
console.log(toHex('K')) | |
} | |
function toHex(str){ | |
var hex = ''; | |
for (var i=0; i<str.length; i++){ | |
hex += str.charCodeAt(i).toString(16); | |
} | |
return hex; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment