Question: Trying to complete a simple node.js exercise, I have tried several variations on this. I suspect I am missing something very simple. 

The reason I created var Calc was because I wanted to export the 'calculator' function.

the error:

```
/Users/alex/zdev/react-project/calc.js:4
    var add = function(){
    ^^^

SyntaxError: Unexpected identifier

```

file calc.js: (file has been shortened to stay concise)

```
var readline = require('readline-sync');

var Calc = {
        var add = function(){
                var num1 = readline.question("num1: ");
                var num2 = readline.question("num2: ");
                console.log(num1 + num2);
        };
}

module.export = Calc;

```

calling file:

```
var calc = require('./calc');

var Calc = new calc.Calc();

Calc.add();
Calc.sub();
Calc.divide();

```

Answer: 
You define a new object `Calc` with a function `add`, but the syntax is incorrect. The correct syntax is:

```
var Calc = {
  add: function() {
    var num1 = readline.question("num1: ");
    var num2 = readline.question("num2: ");
    console.log(num1 + num2);
  }
};

```
I suggest using [JavaScript classes introduced in ECMAScript 2015](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Classes)

```
class Calculator {
  constructor() {
    console.log("[Calc] created!");
  }

  static add(a, b) {
    return a+b;
  }

}

let Calc = new Calculator();

```