题解 | #进制转换#
进制转换
http://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
const line = readline()
const option = {
"A": 10,
"B": 11,
"C": 12,
"D": 13,
"E": 14,
"F": 15,
}
const target = line.slice(2).split("").reverse()
const itemList = target.reduce( (total, item, index ) => {
const current = (option[item] || item) * ( 16 ** index )
return total + current
}, 0)
print( itemList )