I need help with removing specific URLs from an array every time they appear. Here is the list of URLs I want to filter out:
"https://basueUrl.com/Claim"
"https://basueUrl.com/ExplanationOfBenefit"
This is my current array:
Array= [
"https://basueUrl.com/Patient"
"https://basueUrl.com/Organization"
"https://basueUrl.com/Claim"
"https://basueUrl.com/Practitioner"
"https://basueUrl.com/Encounter"
"https://basueUrl.com/Condition"
"https://basueUrl.com/Claim"
"https://basueUrl.com/ExplanationOfBenefit"
"https://basueUrl.com/Claim"
"https://basueUrl.com/ExplanationOfBenefit"
"https://basueUrl.com/ExplanationOfBenefit"
]
First Attempt: I tried using a for loop but it didn't work as expected.
for( var i = 0; i < Array.length; i++){
if ( Array[i] === "https://basueUrl.com/ExplanationOfBenefit" || Array[i] === "https://basueUrl.com/Claim") {
Array.splice(i, 1);
i--;
}
}
console.log(Array);
Second Attempt: I also attempted to create a custom remove method, but it didn't yield the desired results.
function arrayRemove(Array, value) {
return Array.filter(function(ele){
return ele != value;
});
}
var result = arrayRemove(Array,"https://basueUrl.com/ExplanationOfBenefit" || Array[i] === "https://basueUrl.com/Claim");
Any suggestions on how I can successfully filter out these URLs would be greatly appreciated!