Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
255 B
0
Indexable
Never
answersOnly = answers.map(answer => answer.answer)
  const duplicateAnswers = answersOnly.filter((element, index, arr) => arr.indexOf(element) !== index)

  if (duplicateAnswers.length > 0) {
    return { error: 'There cannot be duplicate answers.' };
  }