I am learning nodejs and getting error. After defining the callback inside readline.question() and passing the argument i am getting TypeError: callback is not a function. Please help me with this.
rl.question("./dict ", function(inputDictCmd, callback) {
if(inputDictCmd){
var userInput = inputDictCmd.split(" ");
if(userInput.length === 2){
var opr = userInput[0];
var word = userInput[1];
var requestUrl = "www.xyz.com"
if(opr && opr === 'defn' || opr === 'syn' || opr === 'ant' || opr === 'ex'){
if(opr === 'defn'){
var requestType = 'definitions';
request.get(requestUrl, function (err, res) {
callback("SJDKFD");
return callback;
});
}
}
}
}
rl.close();
});