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 text = "";
    $('span b').each(function() {
        if (text !== "") {
            text += ", ";
        }

        text += $(this).text();
    });
    console.log(text);
});