What does `_` mean in this example code:

```
if (_(abc.content).has("abc")){
    console.log("abc found");
}

```

Many people say "\_" means a private member, but if `abc` or `content` is a private member, shouldn't we use `_abc.content` or `abc._content`?

Thank you
['https://Stackoverflow.com/questions/53473475', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7025179/']
For that to be valid, `_` must refer to a *function*. Perhaps the script is using [`underscore`](https://underscorejs.org/#has), in which case `_(abc.content).has("abc")` returns a Boolean - `true` if the `abc.content` object has a *key* of `abc`, and `false` otherwise:

```js
const abc = { content: { key1: 'foo', abc: 'bar' } };

if (_(abc.content).has("abc")){
    console.log("abc found");
}

console.log(_(abc.content).has("keyThatDoesNotExist"))
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js"></script>
```

It probably has nothing to do with private properties, because `_` is a *standalone* function.

The library used might also be lodash:

```js
const abc = { content: { key1: 'foo', abc: 'bar' } };

if (_(abc.content).has("abc")){
    console.log("abc found");
}

console.log(_(abc.content).has("keyThatDoesNotExist"))
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.core.min.js"></script>
```

But to be sure, you'll have to examine `_` - `console.log` it, or see where it's defined, to get some idea.
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
       }
    }
}

```