JavaScript
\nvar convertToBase7 = function(num) {\n    if(num === 0) return \'0\';\n    \n    let temp = Math.abs(num);\n    let res = \'\';\n    \n    while(temp !== 0){\
```\nvar convertToBase7 = function(num) {\n    if(num === 0) return \'0\';\n    \n    let temp = Math.abs(num);\n    let res = \'\';\n    \n    while(temp !== 0){\n        res = temp % 7 + res;\n        temp = Math.floor(temp / 7);\n    }\n    \n    return num >= 0 ? res : `-${res}`;\n};\n```
['JavaScript']