I apply ".length" on the element has id="name", but it counts 29 instead of 14. I wonder where is my mistake? It would be nice if someone can let me know. Thank you!
var name=document.getElementById('name');
var totalTiles=document.getElementById('totalTiles');
totalTiles.textContent=name.length;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example</title>
</head>
<body>
<div id="heading"></div>
<table>
<tr>
<th>Custom sign:</th>
<td id='name'>Montague House
</td>
</tr>
<tr>
<th>Total tiles:</th>
<td id='totalTiles'></td>
</tr>
</table>
<button>Pay Now</button>
<script src="script.js"></script>
</body>
</html>
console.logthenameelement itself instead of it's length and you will see whyname.textContent.length