.delete()

Deletes a key.

delete(key)

Parameter

Description

key

String

The key to delete

Returns

Description

Whether the key was successfully deleted or not

db.get('food'); // ['pizza', 'burger', 'fries']

db.delete('food'); // true

db.get('food'); // undefined

Also allows the use of dot notation:

db.get('student'); // { name: '5antos', number: 12345 }

db.delete('student.number'); // true

db.get('student'); // { name: '5antos' }

Last updated