# \_.isEmpty（是否为空）

**语法：**

```javascript
_.isEmpty(value)
```

**源代码链接：**[source](https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L11478)

**npm包链接：**[npm package](https://www.npmjs.com/package/lodash.isempty)

**描述：**

检查`value`是否为一个空对象，集合，映射或者set。 判断的依据是除非是有枚举属性的对象，length 大于 0 的 arguments object, array, string 或类jquery选择器。

对象（Objects）如果被认为为空，那么他们没有自己的可枚举属性的对象。

类数组（Array-like）值，比如`arguments`对象，array，buffer，string或者类jQuery集合的`length`为`0`，被认为是空。类似的，map（映射）和set 的`size`为`0`，被认为是空。

**开始版本：**&#x30;.1.0

**参数：**

* `value (*)`: 要检查的值。

**返回值：**

* `(boolean)`: 如果 value 为空，那么返回 true，否则返回 false。

**例子：**

```javascript
_.isEmpty(null);
// => true

_.isEmpty(true);
// => true

_.isEmpty(1);
// => true

_.isEmpty([1, 2, 3]);
// => false

_.isEmpty({ 'a': 1 });
// => false
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lodash.shujuwajue.com/lang/isempty.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
