title: You are given a two-digit integer n. Return the sum of its digits. Example For n = 29, the output should be addTwoDigits(n) = 11
body: <p>More info:</p>
  
  <p>Input/Output Details:</p>
  
  <p><strong>[time limit]</strong> 4000ms (js)</p>
  
  <p><strong>[input]</strong> integer n</p>
  
  <p>A positive two-digit integer.</p>
  
  <p><strong>Constraints</strong>:
  10 ≤ n ≤ 99.</p>
  
  <p><strong>[output]</strong> integer</p>
  
  <p>The sum of the first and second digits of the input number.</p>
  
  <p>Below is my attempt</p>
  
  <pre><code>function addTwoDigits(n) {
  
  var num = n;
  var n = num.toString();
  var sum = n[0] + n[1];
  return sum;
  }
  
  var userInput= prompt('enter a number');
  
  if (userInput&gt;= 10 &amp;&amp; userInput&lt;=99) {
  
  return addTwoDigits(userInput);
  
  } 
  
  console.log(addTwoDigits(n));
  </code></pre>