Simple JS Solution
\n/**\n * @param {number} num\n * @return {string}\n */\nvar convertToBase7 = function(num) {\n    if (num === 0) return \'0\';\n    const sign = num < 0 ? \'-\
```\n/**\n * @param {number} num\n * @return {string}\n */\nvar convertToBase7 = function(num) {\n    if (num === 0) return \'0\';\n    const sign = num < 0 ? \'-\' : \'+\';\n    num = Math.abs(num);\n    let res = \'\';\n    while (num) {\n        res = num % 7 + res;\n        num = Math.floor(num / 7);\n    }\n    return sign === \'+\' ? res : \'-\' + res;\n};\n```
['JavaScript']