title: How to show largest digit from a number - javascript
body: <p>I have this function that calculates the largest digit from a number:</p>
  
  <pre><code>function maxDigit(n){
    if(n == 0){ 
         return 0;
        }
    else{
      return Math.max(n%10, maxDigit(n/10));
    }
  }
  console.log(maxDigit(16984));
  </code></pre>
  
  <p>and the returned value is 9.840000000000003</p>
  
  <p>How can I modifiy this code in order to return just the value 9 ?</p>