Out of bounds exception is not fatal in JS (returns undefined)
Keep consient style for if clauses