array loop not working. only first value logging to console, but calculationsnot working