Chaining

And we want the highest value below 50 (We could use Math.max for this, but we won't)

Without .last method you would need to assign the temporary array to a new variable, in order to get its length later on

// We don't want to modify the original array, so we clone it
var clone = arr.slice();
// We only want numbers below 50
clone = clone.filter(function(a){return a<50});
// Now we want to sort them (we could use Math.max, but for this example we won't)
clone.sort(function(a, b){return a-b});
// And now we can get the last value
clone[clone.length-1];
>>> 20