currency format react native

 

currencyFormat = (num) => {
    var hhj = parseFloat(num);
    var length = hhj.toString().length;
    if (length < 4) {
      var fin_num = hhj;
    } else {
      var fin_num = hhj.toFixed().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
    }
    return fin_num;
  };

Comments

Popular posts from this blog

Simple Redux

Add Axios Interceptor in Services where Api is called

React Interview Questions