I have a list of Id contained in an array :
var listId: string[] = [];
var newId: boolean;
for (let i in data.chunk) {
listId.push(data.chunk[i].aliases[0]);
}
I then want to test my new Id with this whole list. If my new Id is in the list I want to return a false, and if it is not returned a true.
for(let i of listId) {
if(member.userId !== listId[i]) {
newid = true;
}
else {
newId = false;
}
}
I do not see how to do it .. My proposed solution does not work
Try this
if(listId.indexOf(member.userId) !== -1)
{
newId = false;
}else
{
newid = true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With