It is necessary to rewrite all the values of the array into a new variable, but so that the addition operator and subtraction operator is not be like a string, that is, so that the code is executed and the result is 3
How can my problem solve?
Code:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<script>
let a = "1 + 3 - 1";
let arr = a.split(" ");
arr.forEach(function(item, i, arr) {});
//code here
</script>
</body>
</html>