This javascript code needs to pass the invoke the function convert and use its returned value to replace every match. But it is not sending the cid value to the convert function. Any idea how to? Thanks
const convert = function (cid) {
console.log('got: ' + cid); // got NAN
const converted = Math.round(Number(cid) * 16.3871);
console.log(converted);
return converted
};
return myStr.replace(/(\d{3})/g, convert('$1'));
}