ans = 2 + 3;
console.log(`ans`, ans); // 5
I know this will give the sum of 2 + 3 which is 5
but is there a way I can pass the arithmetic operation(+,-,*,/) in a string?
Eg:
let operation = '+'; // it can be +, -, *, /
let ans = 2 operation 3; // how I can do this
console.log(`ans`, ans); // 5