I am familiar with the contains(array, object)
function, but I am in need of a "does not contain" function. I can't think of any logic to work around it, so I could use some help!
My code currently is the exact opposite of what I need. It is only appending objects that are contained in the array
; I want it to append every object that is NOT in array
.
Code is here:
var array = ["Ben", "Jessica", "Cody", "Katie", "Jacob"]
if array.contains("Ben") {
print("Contains Ben")
}
Feeling dumb.
!contains(array, "Ben")
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