Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Takes in a 12 character string and converts
- // each input character to an equivalent hex code.
- // Concatenates the hex codes into a single string
- // and returns that.
- const toHex = (str) => {
- let result = '';
- for (var i=0;i<str.length;i++){
- result += str.charCodeAt(i).toString(16);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement