javascript program to find sum of N numbers