Jolly Jumper golfed

http://codegolf.stackexchange.com/questions/3610/jolly-jumper-sequence

by briguy37

JavaScript

function a(l){for(r=i=1;i<(m=l.length);i++){for(j=t=0;j+1<m;)t+=(d=l[j]-l[++j])*d==i*i;t||(r=0)}return r}

alert(a([1,3,0,-1,-5]));//jolly
alert(a([1,2,4,7]));//jolly
alert(a([1,3,4,7]));//jolly
alert(a([4,3,4,7]));//not jolly