src/docs/src/KV/get.md
When passed a key, will return that key's value, or undefined if the key does not exist.
puter.kv.get(key)
key (String) (required)A string containing the name of the key you want to retrieve the value of.
A Promise that will resolve to the key's value. If the key does not exist, it will resolve to undefined.
<strong class="example-title">Retrieve the value of key 'name'</strong>
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
(async () => {
// (1) Create a new key-value pair
await puter.kv.set('name', 'Puter Smith');
puter.print("Key-value pair 'name' created/updated
");
// (2) Retrieve the value of key 'name'
const name = await puter.kv.get('name');
puter.print(`Name is: ${name}`);
})();
</script>
</body>
</html>