title: Reverse of a string in javascript
body: <p>Define a function reverse() that computes the reversal of a string. For example, reverse("jag testar")should return the string "ratset gaj".As I am getting errors and I am new to javascript .I got the code .but it is not executing </p>
  
  <pre><code>//my code 
  function (string)
  {
      var length = string.length;
      var reversed = [];
      var joined = ("");
      for (var i = length; i &gt; 0; i--){
          reversed.push(string.charAt(i-1));
      }
  
      for (i = 0; i &lt; (length) ; i++){
          joined += (reversed[i]);
  
      }
  
      return joined ;
  </code></pre>