Okay, so this is my code. As you can see, I'm trying to filter abilities that don't contain a specific string within them, then parse them as JSON and return the results: Skills = filterObjs(function(obj) {
if (obj.get('type') !== 'ability' || obj.action.indexOf('"triggertime": "turn"') == -1) return false;
let newobj = JSON.parse(obj.action);
newobj["source"] = obj.characterid;
return newobj;
}); When I run it, however, I get the error: TypeError: Cannot read property 'indexOf' of undefined Which makes sense, right? However, I was under the impression that due to short-circuited evaluation , the statement after the OR (obj.action.indexOf('"triggertime": "turn"') == -1) would never evaluate in the first place, so the error wouldn't be thrown. Since that's not the case, how do I correct my code so that it won't throw that error for non-ability objects?