code sample of js timer