Back to all solutions

#504 - Base 7

Problem Description

Given an integer num, return a string of its base 7 representation.

Solution

/**
 * @param {number} num
 * @return {string}
 */
var convertToBase7 = function(num) {
  return num.toString(7);
};