If anyone still has doubts ...
It was quoted by another colleague using the indexOf() method. The return of this method is either "-1", if it does not find the String in the Array, or the position of the case it finds.
To use it with the desired return, you would have to perform a check before, such as:
exampleMethod () {
const expression = ['string1', string2] .indexOf (this.exampleObject);
if (expression! = -1) {
return true;
} else return false;
}
Basically, you would take advantage of this return.
However, the includes() method can simply be used:
exampleMethode(): boolean {
return ['string1', 'string2'].includes(this.exampleObject);
}
The return of this method will do what you want in a simple way. Compares the object string with the string array you want to check, and returns a boolean.