I know that in JavaScript, creating a for loop like this: for(int i = 0; i < arr.length; i++) is costly as it computes the array length each time. Is this be
for(int i = 0; i < arr.length; i++)
It will also depend on whether that getter is doing a calculation, or accessing a known value.