When I run this code I get NaN, but it reads the initial lis correctly. Does .each not work correctly on html elements?
function computeTotal() {
  let total = 0;
  $("li").each(() => {
    total += parseInt($(this).text(), 10);
  });
  $("#total").text(`Total: ${total}`);
}
computeTotal();<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul>
  <li>10</li>
  <li>50</li>
  <li>10</li>
</ul>
<div id="total"></div>It should output a simple total of the numbers inside the lis. But calling this.text() on each li does not return the number inside it.