Try this code, just remember to create a Text Element with #text string as its id.
$w.onReady(() => {
let count = 0 //start time
const endTime = 10000 // end time
const interval = 100 // interval between counts ms
const counter = setInterval(() => {
$w('#text').text = String(count) // update text
count === endTime && clearInterval(counter) // clears the interval when count is equal to endTime
count++ // increment count
}, interval)
})