Format vars.recCount value for an alert?
I'm using JS to formt values. Insted of 1000, I would like it to be 1,000 on the final alert sent to the imbox of users.
I've found this formatter func online, but it is giving me errors:
const formatter = new Intl.NumberFormat('undefined', {
style: 'currency',
currency: 'USD',
// These options are needed to round to whole numbers if that's what you want.
//minimumFractionDigits: 0, // (this suffices for whole numbers, but will print 2500.10 as $2,500.1)
//maximumFractionDigits: 0, // (causes 2500.99 to be printed as $2,501)
});
vars.field1 = formatter.format(vars.recCount)); /* $2,500.00 */
Why?
09/03/2024 5:11:37 PM SCR-160032 Javascript: error while compiling script 'WKF41027/js'.
09/03/2024 5:11:37 PM JST-310000 Error while compiling script 'WKF41027/js' line 11: missing ; before statement (line='vars.field1 = formatter.format(vars.recCount)); /* $2,500.00 */ ' token='); /* $2,500.00 */ ').
The code uses currency, but I'd like just render this as numbers.
This is the alert sent as an email:
Hoy <%= formatDate(new Date(), "%2D/%2M/%4Y") %> , la cantidad de recipients con email comercial es: <%= vars.field1 %> y la cantidad de celular comerciales es <%= vars.field2 %> .