Splicing a number in javascript

I am trying to write 1k 10k and 100k and I am trying to find a form of .splice but for numbers that way I can turn 1000, 10000, and 100000 to k’s while using the same formula for each of them.

Answer

Just divide by 1000.

[1000, 10000, 100000].forEach(x => console.log(x / 1000 + 'k'));

To display one decimal place when needed:

[1320, 14302, 193234].forEach(x => console.log(+(x / 1000).toFixed(1) + 'k'))