title: I can't get eval() to work with my javascript calculation
body: <p>I am working on a javascript code which calculates the value of Pi. So here's the problem. When <code>eval()</code> calculates the string which is generated by the code it <strong><em>returns 1</em></strong>. It is supposed to <strong><em>return 1.49138888889</em></strong> (which is a rough value of <code>Pi^2/6</code>). </p>
  
  <p>Here's the code. It returns the correct calculation as a string, But <code>eval()</code> doesn't calculate it properly.</p>
  
  <pre><code>function calculate() {
    var times = 10;
    var functionpart1 = "1/";
    var functionpart2 = "^2+";
    var x;
    for (var functionpistring = "", x = 1; times != 0; times--, x++) {
      functionpistring = functionpistring + functionpart1 + x.toString() + functionpart2;
    }
    document.getElementById("value").innerHTML = eval(functionpistring.slice(0, functionpistring.length - 1));
  }
  </code></pre>