bin-to-hex converts binary to hexidecimal I wrote this as an exercise. You should probably just do. let bin = 1010101; let dec = parseInt((bin).toString(), 2).toString(16);