Return Largest Number Algorithm Alternate Solution?

Hello All,

I recently completed this challenge with a little help of google searching and the MDN site. The solution I arrived at seems like it is somewhere in-between the intermediate and advanced solution. I wanted to know if anyone else came to something similar or if either of the solutions of the hints page would be preferable to what I came up with for some reason.

function largestOfFour(arr) {

  var largest = [];
  for (i = 0; i < arr.length; i++){
  return largest;


When you post a full solution, please surround it with [spoiler] and [/spoiler] tags.