Added console.log to see the calculation of array 0,1,2. It worked.