I am trying to create some dummy function in nodejs and trying to export it in another file but when I am running it using node index.js it might some sort of silly mistake but its showing error that:
TypeError: spr.comb is not a function
Below is my code:
spread.js
const comb = () => {
const arr = [4,5,6];
const newArr = [1,2,3,...arr];
console.log(newArr);
}
module.exports = comb;
index.js
const spr = require('./spread');
spr.comb();
Someone let me know what I am doing wrong.
spr.comb()is right. thesprhas thecombreference. just dospr()