Skip to content

Instantly share code, notes, and snippets.

Created May 2, 2016
What would you like to do?
function to8bitString(input){
//clamp the value to 8-bits by and with 0xFF
var clampedValue = (input&0xFF).toString(2);
//pad the string to make it easier to read.
return String("00000000" + clampedValue).slice(-8);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment