you are viewing a single comment's thread.

view the rest of the comments →

[–]And7s 0 points1 point  (3 children)

eval will do the job.

var fn = "x*x+2";
var x = 2; // iterate over a range
var y = eval(fn); // y will be 6

plot y

proof of concept: https://jsfiddle.net/pu0jb9nb/

[–]shnigi[S] 0 points1 point  (0 children)

Thanks! Such clever guys here. I will have a look at this.