How to use substring in React Native?
if (total >= 1000){
const total2 = total.substr(total.lenght - 3, total.lenght);
total = total2 + '.' + total.substr(total.lenght - (total.lenght - 1), total.lenght - 3);
}
Error:
undefined is not a function (evaluating 'total.substr (total.lenght - 3, total.lenght);')
My intention is to check if the value is greater than or equal to 1000, divide the string into two parts and put the point in the third house backwards: 1,000