So far I have this code:
var isMatch = viewedUserLikedUsersArray.indexOf(logged_in_user);
if (isMatch >=0){
console.log('is match');
}
else {
console.log('no match');
}
If an element is in an array it will return a number greater or equal to 0 and so I can say isMatch >=0 but this doesn't seem the safest way. How else can I return a true/false from the desired code?
.indexOf()- a return value of-1means the value is not in the array, and any other value means that it is..findor.includes.