JavaScript function to count sum of squares of two max numbers.