What is the best way to get from integer number A -> binary 0xA.
Explanation on example:
- I have [52, 49, 46] -> [00110100, 00110001, 00101110]
- I need [0x52, 0x49, 0x46] -> [82, 73, 70] -> [01010010, 01001001, 01000110]
My solution:
var arr = [52, 49, 46]
for(var i=0; i<arr.length; i++){
arr[i] = parseInt("0x" + arr[i]);
}
Are there any other ways to do it?
Upgrade by Eric Dobbs:
arr = arr.map(x => parseInt(x, 16));