Complete the code to open a KV store in Deno Deploy.
const kv = await Deno.[1].open();
The correct way to access the KV store is through Deno.KV. This opens the key-value store for use.
Complete the code to set a value in the KV store.
await kv.[1](['user', '123'], { name: 'Alice' });
The set method stores a value at the given key path in the KV store.
Fix the error in the code to get a value from KV store.
const user = await kv.[1]('user', '123');
The get method retrieves a value from the KV store. The key must be passed as an array, not separate arguments.
Fill both blanks to delete a key from the KV store.
await kv.[1]([[2]]);
The delete method removes a key from the KV store. The key must be passed as an array of strings.
Fill all three blanks to create a conditional update in KV store.
await kv.[1](['counter'], (current) => current ? current + [2] : [3]);
The update method applies a function to the current value. It increments if exists, otherwise sets to zero.
