I have two numbers of yesterday’s price and today’s price in the table. I want to display the price increase or decrease as a percentage next to today’s price number.
This is my table:
<table>
<thead>
<tr>
<th>yesterday's price</th>
<th>today's price</th>
</tr>
</thead>
<tbody>
<tr>
<td>50</td>
<td>75</td>
</tr>
<tr>
<td>100</td>
<td>50</td>
</tr>
<tr>
<td>82</td>
<td>82</td>
</tr>
</tbody>
</table>
I’m going to change it like this:
By adding what JavaScript codes can I make these changes in the table? Thanks for your help
<table>
<thead>
<tr>
<th>yesterday's price</th>
<th>today's price</th>
</tr>
</thead>
<tbody>
<tr>
<td>50</td>
<td class="increase">75 (+50% increase)</td>
</tr>
<tr>
<td>100</td>
<td class="decrease">50 (-50% decrease)</td>
</tr>
<tr>
<td>82</td>
<td class="nochange">82 (no change)</td>
</tr>
</tbody>
</table>