Any way to achieve indexOf/includes/contains in an expression in a Lightning Component?
Honestly it's a good feature to have in LC but at the moment we are limited to the function expression as mentioned in here. So only option we have is, to do includes/indexOf...
stuffs in the controller/helper and set the appropriate attribute value.
For eg:
controller.js
({
init : function(component, event, helper) {
let word = component.get("v.word"), sequenceToCheck = 'abc';
if (work.indexOf(sequenceToCheck) > -1) {
console.log('sequence exist');
} else {
console.log('sequence does not exist');
}
if (work.includes(sequenceToCheck)) {
console.log('sequence exist');
} else {
console.log('sequence does not exist');
}
}
})