JSFiddle - React, Tailwind, and code Playground

HTML

<p>Ball</p>

<p>Ball</p>

<p>Ball</p>

<p>Boy</p>

<p>Brain</p>

<p>Bat</p>

<p>Bat</p>

CSS

.current-series {
    background: yellow;
}

JavaScript

var letter = 'B';

var array = [];

function finish(){
    jQuery('p').filter(function(){
        $th = jQuery(this);
        if($th.text().substr(0,1).toUpperCase() == letter && jQuery.inArray($th.text(), array) < 0 ) {
            array.push($th.text());
            $th.addClass('current-series');
            
            
        } else {
            return this;
            
        }}).hide();
}

finish();