JSFiddle - React, Tailwind, and code Playground

HTML

<span>
 <b>hi_1</b>
 <b>hi_2</b>
 <b>hi_3</b>
 <b>hi_4</b>
<span>

JavaScript

$(document).ready(function() {
   var textArr = []; 
   $('span b').each(function() {
     textArr.push($(this).text());
   }); 
    alert(textArr.join(','));
});