Note
노마드코더 바닐라 JS 챌린지 10일차 본문
반응형
확실히 늙었나 보다 예전엔 평균 수면시간 4시간이면 거뜬 했는데..........내일은 버스타고 가면서 좀 자야 겠ㄷ....
// 5초마다 입력중
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="css/style.css" />
<title>Momentum App</title>
</head>
<body>
<form class="hidden" id="login-form">
<input
required
maxlength="15"
type="text"
placeholder="What is your name?"
/>
<input type="submit" value="Log In" />
</form>
<h2 id="clock">00:00</h2>
<h1 class="hidden" id="greeting"></h1>
<script src="js/greetings.js"></script>
<script src="js/clock.js"></script>
</body>
</html>
const clock = document.querySelector("h2#clock");
function sayHello() {
console.log("hello");
}
setInterval(sayHello, 5000); b
const clock = document.querySelector("h2#clock");
function getClock() {
const date = new Date();
clock.innerText = `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
}
getClock();
setInterval(getClock, 1000);
// !!! 드디어 작동됨!!!! console.log 짱임.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Momentum App</title>
</head>
<body>
<form class="hidden" id="login-form">
<h1>Time Until Christmas Eve</h1>
</form>
<h2 id="clock">00d 00h 00m 00s</h2>
<h1 class="hidden" id="greeting"></h1>
<script src="clock.js"></script>
</body>
</html>
const clock = document.querySelector("h2#clock");
function getClock() {
const date = new Date();
clock.innerText = `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
}
getClock();
setInterval(getClock, 1000);
https://codesandbox.io/s/a08blueprint-forked-2jxzu?file=/index.html
반응형
'#학습 > AI&IT' 카테고리의 다른 글
노마드코더 바닐라 JS 챌린지 11일차 (0) | 2021.09.02 |
---|---|
2021년 크리스마스 디데이 (0) | 2021.09.02 |
노마드코더 바닐라 JS 챌린지 9일차 (0) | 2021.08.31 |
노마드코더 바닐라 JS 챌린지 8일차 (0) | 2021.08.31 |
노마드코더 바닐라 JS 챌린지 5일차 + 잠 못드는 이 밤 (0) | 2021.08.28 |
Comments