# .fetch()

### fetch(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 to get the value from</p> |

| **Returns**                                                               | **Description**               |
| ------------------------------------------------------------------------- | ----------------------------- |
| [JSONData](https://simpldb.gitbook.io/docs/types-and-interfaces/jsondata) | The value of the provided key |

####

```javascript
db.set('Greeting', 'Hello World'); // 'Hello World'

db.fetch('Greeting'); // 'Hello World'
```

Also allows the use of dot notation:

```javascript
db.set('user', { name: 'Peter', age: 19 }); // { name: 'Peter', age: 19 }

db.fetch('user.name'); // 'Peter'
db.fetch('user.age'); // 19
db.fetch('user.hobbies'); // undefined
```
