let addCommas = (number) => {
let [head, ...rest] = number.toString().split('.');
rest.length === 0 ? rest = ['00'] : rest;
return head.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",") + '.' + rest;
}
the regex part breaks my code on any ios device. even on google chrome.
for the life of me, I couldn't understand why.
any thoughts and or ways I could go around this?