Guest User

Untitled

a guest
Jan 12th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. [ [ RowDataPacket { id: 1, text: 'один-два дня', id_question: 1, answer: 1 },
  2. RowDataPacket { id: 2, text: 'более 5 дней', id_question: 1, answer: 0 },
  3. RowDataPacket { id: 3, text: '3-5 дней', id_question: 1, answer: 0 } ],
  4. [ RowDataPacket { id: 4, text: 'да', id_question: 2, answer: 1 },
  5. RowDataPacket { id: 5, text: 'нет', id_question: 2, answer: 0 },
  6. RowDataPacket {
  7. id: 6,
  8. text: 'не постоянно, Меняется постоянно',
  9. id_question: 2,
  10. answer: 0 } ],
  11. [ RowDataPacket { id: 7, text: 'да', id_question: 4, answer: 0 },
  12. RowDataPacket { id: 8, text: 'нет', id_question: 4, answer: 0 },
  13. RowDataPacket { id: 9, text: 'не помню', id_question: 4, answer: 1 } ] ]
  14.  
  15. for(i=0; i < answearArr.length; i++){
  16. let arr = answearArr[i];
  17. console.log(arr.find({answer: 0}))
  18. }
  19.  
  20. TypeError: # is not a function
  21.  
  22. console.log(arr.find(function(item){ return item.answer == 1; }));
  23.  
  24. console.log(questions.map(function(question){ return question.find(
  25. function(answer){ return answer.answer == 1; }
  26. )}));
Add Comment
Please, Sign In to add comment