I need insert data from array contacts to array data one by one after click button. After click button insert contacts[0], after another click insert contacts[1] without contacts[0] and contacts[2...] after next click insert contacts[2]...
<button id="submit-btn" onclick="myFunc()">Search</button>
const contacts = ['Chriss:23232','Sarah:345232','Bill:893246','Mary:254366',
'Dianne:2434356','Amy:2356546','Andreu:23546457'];
var data = [];
function myFunc(){
//var res = contacts.filter(f => !data.includes(f));
for ( let x = 0; x < contacts.length; x++ ){
data.push(contacts[x]);
}
}
This will save whole contacts.