Billion Million Thousand Convert

PHOTO EMBED

Sat Nov 25 2023 06:39:33 GMT+0000 (Coordinated Universal Time)

Saved by @StephenThevar #javascript

export function convertToBMK(input) {
  return Math.abs(Number(input)) >= 1.0e9
    ? (Math.abs(Number(input)) / 1.0e9).toFixed(2) + " B"
    : Math.abs(Number(input)) >= 1.0e6
    ? (Math.abs(Number(input)) / 1.0e6).toFixed(2) + " M"
    : Math.abs(Number(input)) >= 1.0e3
    ? (Math.abs(Number(input)) / 1.0e3).toFixed(2) + " K"
    : Math.abs(Number(input));
content_copyCOPY

BMK convert => convertToBMK(19999)