---
title: getItem
framework: tvmljs
role: symbol
role_heading: Instance Method
path: tvmljs/storage/1627333-getitem
---

# getItem

Retrieves the data associated with the specified key.

## Declaration

```data
String getItem(
    in String key
);
```

```data
getter DOMString? getItem(
    DOMString key
);
```

## Parameters

- `key`: A String object containing the key being searched for.

## Return Value

Return Value A String object containing the data associated with the passed key.

## Discussion

Discussion The getItem function retrieves the data associated with the given key. If the key does not exist, the function returns null.

## See Also

### Accessing Key-Value Pair Information

- [clear](tvmljs/storage/1627404-clear.md)
- [key](tvmljs/storage/1627380-key.md)
- [length](tvmljs/storage/1627448-length.md)
- [removeItem](tvmljs/storage/1627332-removeitem.md)
- [setItem](tvmljs/storage/1627302-setitem.md)
