Advertisement
cd62131

forEach

Jun 20th, 2018
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (randNum != 3) return;
  2. inputAnswerAll.forEach(
  3.     function(answerText) {
  4.         [
  5.             { text: '寝転', comment: 'いつも寝転んでるよね!' },
  6.             { text: ['落着き', '落ち着'], comment: 'いつも落ち着いてるよね!' },
  7.         ].forEach(
  8.             function(o) {
  9.                 var correct = false;
  10.                 var text;
  11.                 if (typeof o.text !== 'object') {
  12.                     correct = answerText == o.text;
  13.                     text = o.text;
  14.                 } else {
  15.                     text = o.text.find(function(t) { return answerText == t; });
  16.                     correct = !!text;
  17.                 }
  18.                 if (!correct) return;
  19.                 correctAnswerEasyQ();
  20.                 commentary1.innerText = `答えは、【${text}】`;
  21.                 commentary2.innerText = o.comment;
  22.             }
  23.         );
  24.     }
  25. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement