title: Reverse a String with Process.argv
body: <p>I'm super new to Node.js and I was wondering how I can output the value of my function by typing it in Node. So if i was to write 'hello' it would return 'olleh' etc.</p>
  
  <p>I have a problem understanding how to run a function in Node and how to use process.argv to do so. I know that I need to get the second value but I'm not sure how to do it if I have multiple values.</p>
  
  <p>Any help will be appreciated.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function reverseStr(str) {
    var newStr = '';
  
    for (i=str.length-1; i &gt;= 0; i--) {
   newStr+=str[i];
    }
    return newStr;
  }
  
  console.log(reverseStr(process.argv[2]));</code></pre>
  </div>
  </div>
  </p>