JavaScript Storage setItem() Method
JavaScript Storage setItem() Method
The setItem() method is used for setting the value of the specified Storage Object item. It is a very important method of the Storage Object. The Storage Object is either a localStorage object or a sessionStorrage object.
Syntax:-
Its syntax is:- localStorage.setItem(keyname,value) OR sessionStorage.setItem(keyname,value)
Further Explanation:-
Parameter | Description |
---|---|
keyname | Required. A String specifying the name of the key. |
value | Required. A String specifying the value of the key. |