1 – I am using the below code to verify if every element of one array is present in another array.
let expected_ActionLinks = ["Add to Call List", "ChangeOwner","this","Edit","Delete","Sharing","MI/User Reg",
"Convert","Disqualify","Email Preferences"]
let actual_ActionLinks = ["Add to Call List", "ChangeOwner","Edit","Delete","Sharing","MI/User Reg",
"Convert","Disqualify","Email Preferences"]
try{
if(expected_ActionLinks.some(async (element)=>{ actual_ActionLinks.indexOf(element) > -1 }))
{
console.log("All action links are present on the page")
return true
}
else{
console.log("All action links are present on the page")
return false
}
}
I am trying to verify if every element of one array is present in the other array.
For example here – every element of expected_ActionLinks should be present in actual_ActionLinks. If yes, it will return true, if no it will return false.
The problem here is the above code returns always true irrespective of any situation. Please suggest
2
Answers
Remove
async
addreturn
You can use .every of Array