Skip to content

Instantly share code, notes, and snippets.

View zkingboos's full-sized avatar
🛰️
Working from home

José Gabriel zkingboos

🛰️
Working from home
View GitHub Profile
const value = prompt("Input required")
const base = prompt("Base required")
const adapters = { 16: { "A": 10, "B": 11, "C": 12, "D": 13, "E": 14, "F": 15 } }
const formula = value
.split("")
.reverse()
.map((item, index) => `${(adapters[base] || {})[item] || item} * ${base} ^ ${index}`)
.reverse()
.join(" + ");