title: Passing an array infunction gives me undefined in console
body: <p>In below <strong>javascript</strong> code, if I only prints nums which is array pass to the function. it prints the array as well as gives undefined. So below logic gives an answer but in next line it prints out undefined.</p>
  
  <pre><code>function getSecondLargest(nums) {
  
         let deceding = nums.sort(function(a, b){return b-a});
  
  
      for(let i = 0; i&lt;deceding.length ; i++)
          {
              if(deceding[i]&gt;deceding[i+1])
                  {
                      console.log(deceding[i+1]);
                      break;
                  }
          }
  
  
  }
  </code></pre>