Make a user input phone number display as (xxx) xxx-xxxx on entry.

What if I have a Dynamic Item Page and a text element connected to the Database is getting a “number” value (not a string) and all I want to do is add a coma to emphazise the thousands? I would like to show it as a price, for example number = 10000 and show “10,000” @stcroppe
I figured I could add a _viewportEnter(event) to make the function run and use $w(‘#textElement’).text = “”; to update the value of the text element, but I don’t konw how to convert the number to a string and how to format it to add the coma.