JSFiddle - React, Tailwind, and code Playground

HTML

<table>
    <tr>
        <td class='name'>Aliee</td>
        <td class='nick-name'></td>
        <td class='age'>26</td>
    </tr>
    <tr>
        <td class='name'>Brandi</td>
        <td class='nick-name'></td>
        <td class='age'>27</td>
    </tr>
</table>

JavaScript

$('.nick-name').each(function () {
    console.log($(this).text())
    if ($(this).text().length === 0) {
        $(this).text($(this).prev().text());
    }
});