This code doesn't work
x = [1, 2,3,4,5,6]
sum = 0
f.forEach(v => sum = sum + v)
print(sum) # incorrect sum will be here
# workaround is to add it to the object. e.g.
sum = {value: 0}
f.forEach(v => sum.value = sum.value + v)
print(sum.value) # correct sum will be here