题解 | #进制转换#
进制转换
https://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; void async function () { let str=await readline(); //+和*会调用toNumber() console.log(+str) console.log(str*1) //Number()默认转换成10进制 console.log(Number(str)) //parseInt将16(第二参数)进制转化成10进制。 //16进制转2进制 parseInt(str,16).toString(2) console.log(parseInt(str,16)) }()