You're working on code that's extremely low level. we're talking BIOS and hardware level. You have a program that can do a lot of good stuff with data from the hardware, but it takes Hexadecimal codes, and the raw output of the hardware code is in Binary. You need a way using JavaScript to convert binary numbers into hexadecimal ones. You're going to receive the binary data in 8-bit chunks and you have to return it's hexadecimal value as a string. No function convertBinaryArrayToHex(arr) { return an array of hexadecimal values
function convertBinaryArrayToHex(arr) { var res = []; for (var i = 0; i < arr.length; i += 4) { var value = 0; for (var j = 0; j < 4; j++) { value += arr[i + j] << (3 - j); } res.push(value.toString(16)); } return res.join(''); }