let a = ()
function botao() {
var nome = document.getElementById("nome")
var r = document.getElementById("res")
if (nome.value == "") {
alert("Por favor digite um nome!")
}
if (nome.value.length) {
a.push(nome)
r.innerHTML += ` <tr><th scope="row">${nome.value.length}</th> <td>${nome.value}</td>`
}
}
<div class="container">
<h1 class="text-center mt-3">
Agenda
</h1>
</div>
<div class="container">
<table class="table">
<thead>
<tr>
<th scope="col">Nome</th>
</tr>
</thead>
<tbody id="res">
</tbody>
</table>
</div>
<div class="text-center">
<h1 class="text-center mt-2 mb-4">Registe por aqui</h1>
<input type="text" id="nome" name="nome" placeholder="NOME">
<input type="submit" id="btn" onclick="botao()">
</div>