let separator = 265264849; console.log(separator.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ")); // " 265264894 " becomes " 265 265 894 "