LoginSignup
0

More than 5 years have passed since last update.

javascript練習:お腹が空いてますか?

Posted at

お腹が空いてるか聞くjavascriptを作成してみた

confirmの「はい」または「いいえ」でその後の処理を変えています。

qiita.js
var isHungry = confirm('おなかがすいていますか?');
if(isHungry){
  var isRich = confirm('財布に1500円以上入っている')
  if(isRich){
    var isLike = confirm('ピザが好き?')
    if(isLike){
      alert('ピザを食べよう!')
    }
    else{
      alert('oh...')
    }
  }
  else{
    alert('探してみよう!')
  }
}
else{
  alert('寝ないでね!')
}

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0