How to add comma and percent on number counter?

Hi how do I add comma to the numbers and also add a % at the end? I can’t seem to make the code work. Thank you! Just want to make it 100,000 and then also for other numbers like 50%, have % while adding up. It’s hard to find info about this.

})

$w . onReady (()=>{
$w ( ‘#text69’ ). onViewportEnter (()=>{
let count = 99800 //start time
const endTime = 100000 // end time
const interval = 0.1 // interval between counts ms
const counter = setInterval (() => {
$w ( ‘#text69’ ). text = String ( count ) // update text
count === endTime && clearInterval ( counter ) // clears the interval when count is equal to endTime
count ++ // increment count

}, interval )
});

function countUp (){
if ( count <= endTime ){
$w ( ‘#text69’ ). text = count . toLocaleString (). toString ();
count ++;
}
}

})

$w.onReady(()=>{
$w(‘#text69’).onViewportEnter(()=>{
let count = 0 //start time
const endTime = 100000 // end time
const interval = 0.1 // interval between counts ms
const counter = setInterval(() => {
$w(‘#text69’).text = String(count) // update text
count === endTime && clearInterval(counter) // clears the interval when count is equal to endTime
count++ // increment count

}, interval)
});

function countUp(){
if (count <= endTime){
$w(‘#text69’).text = count.toLocaleString().toString().replace(/\B(?=(\d{3})+(?!\d))/g, “,”) + “%”;
count++;
}
}

})

Ref: javascript - How to format a number with commas as thousands separators? - Stack Overflow

Thanks the code above didn’t work but it taught me about the Locale string thing, idk what it means but it worked when I replaced ‘String’ on my code. Thank you!

$w . onReady (() => {
$w ( ‘#text69’ ). onViewportEnter (() => {
let count = 99800 //start time
const endTime = 100000 // end time
const interval = 0.1 // interval between counts ms
const counter = setInterval (() => {
$w ( ‘#text69’ ). text = count . toLocaleString () + “%” ; // update text
count === endTime && clearInterval ( counter ) // clears the interval when count is equal to endTime
count ++ // increment count
}, interval )
})
})