TimohaP,
function g(x0, y0, x1, y1)
{
return Math.sqrt( Math.pow(x1-x0, 2) + Math.pow(y1-y0, 2) )
}
function a(d) {
return d.reduce(function(b, c) {
return g.apply(null,b) > g.apply(null,c) ? b : c
})
};
var array = [
[ 0,0,20,20 ],
[ 0,0,10,10 ]
];
alert(a(array))