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
.hidden {
display: none;
}
JavaScript
var letter = 'B';
var array = [];
function finish(){
jQuery('p').each(function(){
$th = jQuery(this);
if($th.text().substr(0,1).toUpperCase() == letter) {
if(jQuery.inArray($th.text(), array) > -1) {
$th.addClass('hidden');
} else {
$th.addClass('current-series');
array.push($th.text());
}
}
})
}
finish();