Loop through Table

Hi, i’m trying to loop through a table with input values, however when i log the results to the console it shows the html of the input value. How can i prevent this? I either want to show a 0 or number a user types in. Thank you

<table style="background-color: lightblue; width: 40%;" cellpadding="0" cellspacing="0" >
  <tr>
    <th>Item</th>
    <th>Price</th>
    <th style=' width: 30%'>Buy/Sell</th>
  </tr>
  <tr>
    <td>Item A</td>
    <td>1000</td>
    <td style="background-color: red;   padding: 3px;">
        <div style="margin-right: 0px;">
            <div style="padding-right: 3px;">
                <input type="text" style="width:20%"; id='firstItem'>
            </div>
        </div>
      </td>
    </tr>
  <tr>
    <td>Item B</td>
    <td>2000</td>
    <td style="background-color: red;   padding: 3px;">
        <div style="margin-right: 0px;">
            <div style="padding-right: 3px;">
                <input type="text" style="width:20%" placeholder='0'>
            </div>
        </div>
      </td>
    </tr>
  </tr>
  <tr>
     <td>Item C</td>
    <td>3000</td>
    <td style="background-color: red;   padding: 3px;">
        <div style="margin-right: 0px;">
            <div style="padding-right: 3px;">
                <input type="text" style="width:20%;">
            </div>
        </div>
      </td>
    </tr>
  </tr>
</table>
<button onclick='buyItem()'>Buy</button>
<button>Sell</button>

JavaScript:

function buyItem() {
// let x = document.getElementById('firstItem').value;
  //console.log(x);
  const cells = document.querySelectorAll('td');
cells.forEach(function(cell) {
  
  console.log(cell.innerHTML);
})
}

Also my console says it ‘cannot read property ‘elements’ of null’ why is this. When i check online i always find this ‘elements’ property but it doesnt work?

<form id="exampleFormIdentifier">
    <p><input name="somefield"></p>
    <p><input name="anotherfield"></p>
    
</form>

let form = document.querySelector('exampleFormIdentifier');
let elements = form.elements;
let i;
   
    
for (i = 0; i < elements.length; i++) {
    // do stuff with elements[i] here
  console.log(i);
}

No need ive solved the problem