Version: v0.7.0 - Beta.  We welcome contributors & feedback.

Math.convertBase

Math.convertBase($n, $fromBase, $toBase) -> number|string

Description

Convert $n from one base to another.

Non-decimal results are returned as a String.

Math.convertBase(21, 10, 2)
//= '10101' (decimal to binary)

Math.convertBase('1af9', 16, 10)
//=  6905   (hex to decimal)