I am trying to get the content inside of a by the class name but i get undefined when i run the script... what am i doing wrong?
<!DOCTYPE html>
<html>
<body>
<td class="a-size-base">B000FNFSPY</td>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var x = document.getElementsByClassName("a-size-base").innerText;
document.write(x)
}
</script>
</body>
</html>