This looks very readable and clear which is great, but there is one subtle bug.
Array.sort is a little weird:
If compareFunction is not supplied, elements are sorted by converting them to strings and comparing strings in Unicode code point order. For example, "Cherry" comes before "banana". In a numeric sort, 9 comes before 80, but because numbers are converted to strings, "80" comes before "9" in Unicode order.
In other words, you maximum value finding logic is wrong:
sumSquareLargest(2, 3, 12); // 13 rather than expected 153 since "12" < "2" < "3"
Luckily the fix is easy. You just need to provide your own comparator:
var numbers = [x, y, z];
numbers.sort(function(a, b) { return a - b; });
Also, perhaps I'm just going through one of my functional kicks, but I would be tempted to utilize slice and reduce:
function sumSquareLargest(x, y, z) {
return [x, y, z].sort(function(a, b) { return a - b; }).slice(1, 3)
.reduce(function(sum, x) { return sum + x*x; }, 0);
}
Or, with some bits pulled out to make it a bit clearer:
function numberLessThan(a, b) { return a - b; }
function addSquare(sum, sq) { return sum + sq*sq; }
function sumSquareLargest(x, y, z) {
return [x, y, z].sort(numberLessThan).slice(1, 3).reduce(addSquare, 0);
}
On second thought, now that I've actually written this out and seen it, I think the simple approach is better. This just gets a bit too unwieldy. I'll leave it anyway as an option though, especially since it could be useful if you wanted to make a version that operated on any number of values instead of 3.
(Note: I've just declared my functions the way I have because it's the style I prefer in this situation. There's no meaningful difference.)