‘in’ operator in JavaScript. String comparison [duplicate]

I think one way is to use String.indexOf()

'aaa' .indexOf('a') > -1

In javascript the in operator is used to check whether an object has a property

Leave a Comment