Members
(readonly) length :Number
Returns an integer representing the number of data items stored in the MemoryStorage object.
Type:
- Number
 
Methods
clear()
This method clears all keys stored in a given MemoryStorage object.
Example
window.memoryStorage.clear();
        
            
    
    getItem(keyName) → {String}
This method, when passed a key name, will return that key's value, or
null if the key does not exist, in the given MemoryStorage object.
Example
const currentFont = window.memoryStorage.getItem("currentFont");
    Parameters:
| Name | Type | Description | 
|---|---|---|
keyName | 
            
            String | A string containing the name of the key you want to retrieve the value of.  | 
        
Returns:
A string containing the value of the key. If the key does not exist,
null is returned.
- Type
 - String
 
key(index) → {String}
This method, when passed a number n, returns the name of the nth key in
a given MemoryStorage object.
Example
Iterates over the storage keys
for (let i = 0; i < window.memoryStorage.length; i++) {
  console.log(window.memoryStorage.key(i));
}
    Parameters:
| Name | Type | Description | 
|---|---|---|
index | 
            
            Number | An integer representing the number of the key you want to get the name of. This is a zero-based index.  | 
        
Returns:
A string containing the name of the key. If the index does not exist,
null is returned.
- Type
 - String
 
removeItem(keyName)
This method, when passed a key name, will remove that key from the given
MemoryStorage object if it exists. If there is no item associated with
the given key, this method will do nothing.
Example
window.memoryStorage.removeItem("currentFont");
    Parameters:
| Name | Type | Description | 
|---|---|---|
keyName | 
            
            String | A string containing the name of the key you want to remove.  | 
        
setItem(keyName, keyValue)
This method, when passed a key name and value, will add that key to the
given MemoryStorage object, or update that key's value if it already
exists.
Example
window.memoryStorage.setItem("currentFont", "Helvetica");
    Parameters:
| Name | Type | Description | 
|---|---|---|
keyName | 
            
            String | A string containing the name of the key you want to create/update.  | 
        
keyValue | 
            
            String | A string containing the value you want to give the key you are creating/updating.  |