二进制转十进制
var num1 = 1111;
var returnNum = parseInt(num1,2).toString(10);
console.log(returnNum) //'15'
二进制转八进制
var num1 = 1111;
var returnNum = parseInt(num1,2).toString(8);
console.log(returnNum) //'17'
二进制转十六进制
var num1 = 1111;
var returnNum = parseInt(num1,2).toString(16);
console.log(returnNum) //'f'