In my Vuejs below I want to filter the reviewed:true only questions, and get the length of them, but my code below gives an error TypeError: question.reviewed.includes is not a function ,is there a way to do it?
reviewed:true
TypeError: question.reviewed.includes is not a function
Here is the screenshot about the json file: JSON File
filterReviewed() { return this.questions.filter((question) => { return ( question.reviewed .includes('true') ); }); },
includes is a method of Object of Array type. Directly judge attribute reviewed is OK
includes
Array
reviewed
filterReviewed (){ return this.questions.filter((question) => question.reviewed); }
1.4m articles
1.4m replys
5 comments
56.9k users