Hello there,
I am trying to convert a symbol inside a string to a symbol without string, I tried a lot but nothing got it works. what method I can use to do that?
here is my code down below:
function operator(op){
var prevValue = 2;
var nextValue = 5;
var operator = op;
var calculation = prevValue operator nextValue;
return calculation;
// how do I convert '+' to + to calculate both numbers??
// how do I get 7 instead of '2+5'??
};
operator('+');