Snippets Collections
 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;
    }
  };
star

Thu Sep 01 2022 09:12:11 GMT+0000 (UTC)

#convert #money #rupee

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension