Error TypeError is not a function in Node js

0 votes

I'm getting the error while running the following code in Node.js

var assert = require('assert');
var request = require('request');
var index = require('./index');
it('verify javascript function', function(done) {
    var v2 = index.AddNumbers(5, 6);
    assert.equal(11, v2);
    done();
});

The index.js file contain the following code:

function AddNumbers(a,b){
    return a+b;
}

What am I doing wrong?

Oct 15, 2020 in Node-js by kartik
• 37,520 points
18,803 views