# 時間顯示 (JS) 說明:從函式庫取得時間,並每秒更新至畫面中 ```javascript= function updateTime() { let dateTime = new Date(); // TODO: 分別取得時、分、秒 let hour = ??? let min = ??? let sec = ??? // TODO: 若時、分、秒無十位數字則補零 if (???) { hour = ??? } . . . // TODO: 取得time的標籤 let clockTime = ???; clockTime.textContent = `${hour} : ${min} : ${sec}`; } let interval = 1000 // ms updateTime(); //第一次需手動呼叫 // TODO: 使用 setInterval 定時呼叫函式,更新時間 ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up