Parse a string in parameters array to be read as a formula

How do I convert the string in a parameter, i.e.
Code:
var phitsform = (parameters['Possible Hits Formula'], "a.agi / 16");

so that when I call this variable, it will return it as a readable formula instead of a string

EDIT: More specifically, I need it to calculate the formula instead of printing it out

EDIT 2: Looking at documentation, I found the eval(); function, which works, but I don't know if that's the recommended way to do that or not.
The only way to "evaluate" a formula stored in a string is to run eval. For best results though, run your eval in a try/catch block, thus:

Code:
try
{
  var formulaResult = eval("7 + 9");
}
catch(e)
{
  console.log("something went wrong");
}
Oh. I didn't even think about a try catch block, or realize that it's the same syntax as C#.

But this thread is solved so it can be closed.
@RedFoxGaming You could also create a new function on-the-fly, if you do not want to trust eval for some reason.

Code:
// new Function(parameter, code)(argument)
new Function('a', 'return ' + phitsform + ';')(a);

Original thread: https://forums.rpgmakerweb.com/threads/parse-a-string-in-parameters-array-to-be-read-as-a-formula.117512/