Search code examples
javascriptjslint

JSLint : Expected 'new' before


I am facing issue in calling ReturnData(); method in CreateOutput().

Here is the code.

function ReturnData() {
    "use strict";
    return "The data";
}


function CreateOutput() {
    "use strict";
    var takeValue = ReturnData();
    bind(takeValue);
}

Error

JSLint : Expected 'new' before 'ReturnData'.


Solution

  • JSLint is assuming that ReturnData is a constructor. You could rename it to returnData or turn the rule off. You can turn it off with --newcap on the commandline.