Wednesday, 3 May 2017

Is it possible to evaluate a vector which is write as a string character in javascript?

I'm using a server in node.js. After multiple procedures, I came with several vectors like ANI0 and a Mathematical expression like Math0. Whereby I need to evaluate these operation for each value comprised in ANIO. I tried using the command eval but it does not work. Is it even possible to do that using some commands??

var ANI0 = [34,76, 32, 12 56, 89];
var Math0; 

for (i=0; I<ANIO.length; i++){
   Math0 = '(ANIO[i]-0.01)/20';
   Math0 = eval(Math0); //Error!!!

//Do another stuff
}



via Margarita Gonzalez

No comments:

Post a Comment