JS Sisipkan satu titik masing -masing tiga digit

function formatNumber(num) {
  return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.')
}
Gorgeous Grebe