I have an array named var_name
How to check in an array if there is an element other than detected
but if my array does not contain detected
and contains different element, it shouldn't do anything. For instance:
var_name = [detected, nondetected]it should execute<div> Do something </div>var_name = [nondetected, inprogress]it should execute<div> Do nothing </div>var_name = [detected, detected]it should execute<div> Do nothing </div>
Things tried so far:
!var_name.includes('detected') ? (<div>Do something</div>) : (<div>Do nothing</div>)
but it fails for my usecase
So in order to do something, there needs to be at-most 1 instance of detected followed by other elements (like nondetected, etc). If it contains all detected, then still it doesn't do anything. How to execute such that?