const convertion = (value, last = 0) => { if (value > 0) { value = Math.round(value); var strlength = value.toString().length; var amount; if (strlength >= 4 && strlength < 6) { amount = Math.abs(value / 1000).toFixed(1) + "K"; } else if (strlength >= 6 && strlength < 8) { if (last === 1) { amount = Math.abs(value / 100000).toFixed(1) + "+ Lakh"; } else { amount = Math.abs(value / 100000).toFixed(1) + " Lakh"; } } else if (strlength >= 8) { if (last == 1) { amount = Math.abs(value / 10000000).toFixed(1) + "+ Cr"; } else { amount = Math.abs(value / 10000000).toFixed(1) + " Cr"; } } else { amount = value; } return amount; } };
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter