Beginner series sum of all the numbers

Given two integers, which can be positive and negative, find the sum of all the numbers between including them too and return it. If both numbers are equal return a or b.

Note! a and b are not ordered!

Expected output is as follows:

Sum of all the numbers solution – the beginner’s way

You can play around with the code in JSFiddle

Sum of all the numbers ┬ásolution – the clever way using javascript recursion

You can play around with the code on JSfiddle