function numberToString(n, base) {
var result = "", sign = "";
if (n < 0) {
sign = "-";
n = -n;
}
do {
result = String(n % base) + result;
n = Math.floor(n / base);
} while (n > 0);
return sign + result;
}
console.log(numberToString(5,2));
Output: 101
The “Do” portion of the code I do not understand. Is this recursion? Is the computer running through the whole “Do” statement multiple times? Any help is greatly appreciated. Thank you.