Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(args) {
- const num = args[0];
- let result = 0;
- let digit;
- for (let i = 0; i < num.length; i++) {
- if (num[i] >= '0' && num[i] <= '9')
- {
- digit = num[i].charCodeAt(0) - '0'.charCodeAt(0);
- }
- else
- {
- digit = num[i].charCodeAt(0) - 'A'.charCodeAt(0) + 10;
- }
- result = result * 16 + digit;
- }
- console.log(result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement