That's just a variable name. You are right, conventions suggest that underscore refer to private members in an object such as:
const num = 2;
function Multiply(num) {
this._multiplier = 2;
this._input = num;
this.start = function(){
return this._multiplier * this._input;
}
}
const product = new Multiply(num).start(); //4
But the concept of private members has nothing to do with your example.
In your case, _()
is actually a function;
function _ (){
return "I love potatoes";
}
a function that returns an object that contains the .has()
method. The structure of that function of yours could be dumbed down to something like
function _(args){
const content = args;
return {
has: function(data){
//do something
return true; //some boolean expression
}
}
}