Skip to content

Instantly share code, notes, and snippets.

@cloneko
Last active August 29, 2015 14:02
Show Gist options
  • Save cloneko/dfa1065698c107c00bec to your computer and use it in GitHub Desktop.
Save cloneko/dfa1065698c107c00bec to your computer and use it in GitHub Desktop.
おごってもらうJS
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>JS</title>
<script>
function isLive(){
// 約20%の確率?で返事をしなくなる。
return Math.random() < 0.8 ? true : false;
}
</script>
</head>
<body>
<script>
while(isLive()){
// 何の圧力かわからないが、デフォルトはyesらしい…
var response = window.prompt("よなしろせんせーおごってください!","yes");
// yesって言ってくれないとオゴってくれることにはならない。
if(response != 'yes'){
// 表面上
alert("(´・ω・`)");
// 心の中
console.log("チッ");
continue;
}
alert("先生におごってもらう(・ิω・ิ);");
console.log("ちょろいぜ…へへへ…");
}
document.write("よなしろせんせーは返事をしなくなった。");
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment