How To Get Text By Id From Array? React
CurrentUserAnswerVariants: {id: '4468cdc8-220d-4634-9d68-6c9920e0cb48', text: 'Question 1', minAnswersQuantity: 1, maxAnswersQuantity: 1, canComment: false, canComm
Solution 1:
functionidEquals(idToCompare, question) {
return question.id.indexOf(idToCompare) === 0;
}
currentUserAnswerVariantsVariantIds = question.filter(idEquals.bind(this, currentUserAnswerVariants));
Does this work? It's something along these lines, and you may edit the following code accordingly.
Solution 2:
- $var = $('#id').val();
- $var['text']; -> only if you need single id text
-> or use foreach on id and push the each result into one blank array and print array
Post a Comment for "How To Get Text By Id From Array? React"