How to write a function in JavaScript to show the longest string in an array : <p>This is my code so far and it doesn't seem to work. I could use some help.</p>

<pre><code>function longestString(arr) {
  var longest =0;
  for (var i = 0; i &lt; arr.length; i++) {
    if (arr[i].length &gt; longest.length) {
      longest = arr[i];
    }
  }
}
</code></pre>

<p>I am not sure what I am doing wrong.</p>
