filters.js 297 Bytes
export  function filterTotal(val) {
  let str = val.toString()
  let newStr = ''
  let count = 0
  for(let i=str.length-1;i>=0;i--){
    if(count % 3 == 0 && count!= 0){
      newStr = str.charAt(i)+","+newStr
    }else{
      newStr = str.charAt(i)+newStr
    }
    count++
  }
  return newStr
}