Convert hex to bin preserving long format

Hi all, i need to convert hex value eg "24" to bin. "00100100".
Using the msg.payload = parseInt(msg.payload,16).toString(2) the result is "100100".
How can obtain a long format value with all 8 bit "00100100"?

Best regards!

try appending the .padStart(8, '0') method

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.