.delete()

Deletes a key. Returns a boolean based on whether the key was successfully deleted or not.

delete(key)

Parameter

Description

key

String

The key to delete

Returns

Description

Whether or not the key was successfully deleted

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