Skip to content

Instantly share code, notes, and snippets.

@Kazunari-h
Created May 17, 2019 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kazunari-h/8d41464ec56753837dc664c41c0267c9 to your computer and use it in GitHub Desktop.
Save Kazunari-h/8d41464ec56753837dc664c41c0267c9 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>タイマー処理</title>
</head>
<body>
<script>
// 一定秒後に処理を行う!
let log = function () {
console.log("こんにちは");
};
// setTimeout(log, 3000); // 3秒後に"こんにちは"と表示されます
// 仕掛けた setTimeout を無効にする
// let timer1 = setTimeout(log, 3000);
// clearTimeout(timer1);
// 一定秒ごとに処理を行う!
// setInterval(log, 3000); // 3秒ごとに"こんにちは"と表示されます
// 仕掛けた setInterval を無効にする
// let timer2 = setInterval(log, 3000);
// clearInterval(timer2);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment