Why this code doesn't work?

function sumAll(arr) {
  var sum=0;
  for(var i=min;i<=max;i++)
  return sum;

sumAll([1, 4]);

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

What you are doing is looping over the array [1,4] from index 1 to 4. But it only has index 0 and 1. So instead of arr[i] (which is undefined most of the time) just use i (which is the actual value you want to add.