Question: I am trying to solve a problem given to me and it involves using basic loops, functions and conditions. I have been given the below:

```
// TODO: complete program

console.log(calculate(4, "+", 6));  // Must show 10
console.log(calculate(4, "-", 6));  // Must show -2
console.log(calculate(2, "*", 0));  // Must show 0
console.log(calculate(12, "/", 0)); // Must show Infinity

```

and this is my attempt (not working of course). Can anyone give me a nudge of a pointer as to what I am doing wrong?

```js
function calculate(n1, n2, n3) {
  let calc
  if n2 = "+" {
    (calc = +)
  };
  else if n2 = "-" {
    (calc = -)
  };
  else if n2 = "*" {
    (calc = * )
  };
  else {
    (calc = /)
  };
  let acalc = (n1 + n2 + n3);
  return acalc;
}

console.log(calculate(4, "+", 6)); // Must show 10
console.log(calculate(4, "-", 6)); // Must show -2
console.log(calculate(2, "*", 0)); // Must show 0
console.log(calculate(12, "/", 0)); // Must show Infinity
```

Answer: 
You can't set variables equal to operators. Your `if` blocks should look like this instead:

```
if (n2 == "+") {
  return parseInt(n1) + parseInt(n3);
};

```

Use `parseInt` if you are passing in strings instead of numbers
I'd take the input given in the n2 parameter and return the calculation directly. Also you had some issues with () in your code.

```
function calculate(n1, n2, n3) {
if (n2 == "+") {
    return n1 + n3;
} else if (n2 == "-") {
    return n1 - n3;
} else if (n2 == "*") {
    return n1 * n3;
} else {
    return n1 / n3;
}; };

```