Function to filter comments and ratings, with pagination support
If one of your filters is undefined, just set it to always succeed.

If one of your parameters is undefined, set it to something so that you don't have to check it over and over.

Truncate output to pagesize at the end.

filterFeedback(items) {
    const pagination = { offset: 0, limit: 10, totalCount: items.length };
    const filtRatings=new Set( 
        ( this.filterBy.rating &amp;&amp; this.filterBy.rating.length ) ?
          this.filterBy.rating : items.map( item =&gt; item.rating ) 
    );
    const filtComment=this.filterBy.comment || '';

    return items.filter( item =&gt; 
        ( item.comment || '' ).includes(filtComment) 
        &amp;&amp; 
        filtRatings.has(item.rating) 
    )
    .slice(0,pagination.limit);

}