Executando verificação de segurança...
1

Use o String() para converter o número em string
tbm existe o Number() para fazer a conversão de string para número

let num = 15;

const numberToString = String(num)
console.log(numberToString, typeof numberToString) // 15 string

Agora tem os métodos de string:

console.log(numberToString.slice(0)) //150
console.log(numberToString.slice(1)) //50
console.log(numberToString.slice(2)) //0

> number.toString(radix)

Must be an integer between 2 and 36.
Base 2 is binary
Base 8 is octal
Base 16 is hexadecimal.

let text = num.toString(2); //return 1111 Base binary
let text = num.toString(8); //return f Base octal
let text = num.toString(16); //return f Base hexadecimal
Carregando publicação patrocinada...