Can someone tell me how to make a timer?

I wanted to make a timer for my game. But i don’t know how. Can anyone help me?

Here’s the code:

Code
project.timerValue = 0;

window.setTimeout(timerAdd, 1000, project, 10);
// window.setTimeout(function, ms, object, end);
// 1000ms = 1s

function timerAdd (obj, end) {
    obj.timerValue += 1;
    if (obj.timerValue < end) {
        window.setTimeout(timerAdd, 1000, obj, end);
    }
}

Here’s the example:
Timer Example3-9-2020_7-00-06PM.wick (3.5 KB)

Do i use it on a frame?

yes, you can also use it on an object