Js copies the value from the last tr of table

function copy(){
    var tb = document.getElementById("table");
    var tr = document.querySelectorAll("-sharptable tr:last-of-type td").value;
    alert(tr);
    var copyalbe = tr;
    var input = document.createElement("input");
    input.value = copyalbe;
    document.body.appendChild(input);
    input.select();
    document.execCommand("copy");
    input.style.display = "none";
    alert("");
  }
<table id="table" width="200" border="1" cellspacing="0">
    <tr id="cow1">
      <td>123</td>
      <td>111</td>
    </tr>
    <tr id="cow2">
      <td>123</td>
      <td>111</td>
    </tr>
    <tr id="cow3">
      <td class="copyalbe">123</td>
      <td class="copyalbe">111</td>
    </tr>
  </table>
  <input id="btn" type="button" value="" onclick="copy()">

I want to get the value of two td in the last tr in table and copy it, but I don"t know how to get the value. Do you have any advice from an old friend?

Mar.05,2021

what are your requirements?
1. Get the values of the last two td of table.
2. Save these two values in the pasteboard for replication.

<table border="1">
  <tr>
    <td>123</td>
    <td>111</td>
  </tr>
  <tr>
    <td>123</td>
    <td>111</td>
  </tr>
  <tr>
    <td>222</td>
    <td>333</td>
  </tr>
</table>
<input type="button" value="" onclick="copy()" />

<br />

textarea CTRL+V

<textarea cols="30" rows="10"></textarea> <script> function copy() { let values = [...document.querySelectorAll('table tr:last-child td')].map(t => t.innerHTML); /* : var values = []; var tds = document.querySelectorAll('table tr:last-child td'); for (var i=0; i< tds.length; iPP) { values.push(tds[i].value); } */ let input = document.createElement('input'); document.body.appendChild(input); input.value = values.join('+'); input.focus(); input.setSelectionRange(0, input.value.length); document.execCommand('copy', true); document.body.removeChild(input); } </script>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ee64-2c454.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ee64-2c454.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?