Есть таблица с данными и массив. Данные из этой таблицы хранятся в массиве.Как по клику по кнопке "удалить", удалять этот объект из массива?
var contacts = [{name:"Mark",surname:"Otto",username:"@mdo"},
{name:"Jacob",surname:"Thornton",username:"@fat"},
{name:"Larry",surname:"the Bird",username:"@twitter"}]
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Имя</th>
<th scope="col">Фамилия</th>
<th scope="col">Username</th>
<th scope="col">Очистить</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
<td><button>удалить</button></td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
<td><button>удалить</button></td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
<td><button>удалить</button></td>
</tr>
</tbody>
</table>