removeItem
Summary
Removes the key/value pair with the given key from the list associated with the object, if it exists.
Method of apis/web-storage/Storageapis/web-storage/Storage
Syntax
object.removeItem(key);
Parameters
key
- Data-type
- String
The name of the key, or the empty string.
Return Value
No return value
Examples
// Check for support of sessionStorage
if(window.sessionStorage) {
// Add a key/value pair
sessionStorage.setItem('someKey', 'value');
// Remove the item you just added
sessionStorage.removeItem('someKey');
}
Related specifications
- W3C Web Storage Specification
- W3C Editor’s Draft
Attributions
Microsoft Developer Network: Windows Internet Explorer API reference Article