> For the complete documentation index, see [llms.txt](https://simpldb.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://simpldb.js.org/v1/documentation/database/has.md).

# .has()

Returns a boolean based on whether an element or property exists or not.

### has(key)

| Parameter | Description                                                                                                                                            |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| key       | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></p><p>The key that will be checked</p> |

| Returns                                                                                             | Description                                                  |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | Whether or not an element or property exists in the database |

####

```javascript
db.set('prefix', '!'); // '!'

db.has('prefix'); // true
```

Also allows the use of dot notation:

```javascript
db.set('profile', { username: '5antos' }); // { username: '5antos' }

db.has('profile.username'); // true
db.has('profile.password'); // false
```
