If in event sheets, you'll have to declare and pass a local variable to a JS action. Let's say it's a string called num
:
let num = localVars.num;
let string = "";
for (let i = 1; i <= num.length; i++) {
string = num[num.length - i] + string;
if (i < num.length && ! (i % 3)) string = " " + string;
};
localVars.num = string;
Then set your text to num
. If it's not already a string, you'll have to convert it first.
Basically, copy the string (number) starting from the last digit and adding a space every 3rd digit, unless it's the final (first) digit.