Storage.setItem()


ืคื•ื ืงืฆื™ื™ืช ()setItem ืžืืคืฉืจืช ืœื”ื•ืกื™ืฃ ื ืชื•ื ื™ื ืืœ ื”ืื—ืกื•ืŸ ื”ืžืงื•ืžื™ ื‘ืืžืฆืขื•ืช ืฉื ื™ ืคืจืžื˜ืจื™ื: ืฉื ืžืคืชื— ื•ืขืจืš ืฉืื•ืชื ืชื™ืฆื•ืจ ืื• ืชืขื“ื›ืŸ ื‘ืžื™ื“ื” ื•ืงื™ื™ืžื™ื.

ืชื—ื‘ื™ืจ

storage.setItem(keyName, keyValue);

ืคืจืžื˜ืจื™ื

keyName
ืžื›ื™ืœ ืืช ืฉืžื• ืฉืœ ื”ืžืคืชื— ืื•ืชื• ื™ืฉ ืœื™ืฆื•ืจ ืื• ืœืขื“ื›ืŸ.
keyValue
ืžื›ื™ืœ ืืช ืฉื ื”ืขืจืš ืฉื™ืชื•ื•ืกืฃ ืœืžืคืชื— ืื•ืชื• ืื ื• ื™ื•ืฆืจื™ื ืื• ืžืขื“ื›ื ื™ื.

ืขืจืš ื—ื•ื–ืจ

undefined.

ื”ื—ืจื’ื•ืช

ื‘ืžื™ื“ื” ื•ื”ืื—ืกื•ืŸ ืžืœื ื”ืžืขืจื›ื•ืช ืขืฉื•ื™ื” ืœื ืงื•ืช ื ืชื•ื ื™ื ืžื”ืื—ืกื•ืŸ ื”ืžืงื•ืžื™.
ื‘ื’ืจืกื” ื”ื ื™ื™ื“ืช ืฉืœ ื“ืคื“ืคืŸ Safari, ื‘ืžื™ื“ื” ื•ื”ืžืฉืชืžืฉ ื ื›ื ืก ืืœ ืžืฆื‘ ืคืจื˜ื™ ื”ืžืขืจื›ืช ืื™ื ื” ืฉื•ืžืจืช ื ืชื•ื ื™ื ื‘ืื—ืกื•ืŸ ื”ืžืงื•ืžื™ ื•ืžืกื™ืจื” ืื•ืชื ื‘ืื•ืคืŸ ืื•ื˜ื•ืžื˜ื™ ื‘ืฉืœ ืžื’ื‘ืœืช ื’ื•ื“ืœ ืฉืœ 0 ื‘ืชื™ื.

ื“ื•ื’ืžืื•ืช

ื”ืคื•ื ืงืฆื™ื” ื”ื‘ืื” ื™ื•ืฆืจืช ืฉืœื•ืฉื” ืคืจื™ื˜ื™ ื ืชื•ื ื™ื ื‘ืชื•ืš ื”ืื—ืกื•ืŸ ื”ืžืงื•ืžื™.

function populateStorage() {
  localStorage.setItem('bgcolor', 'red');
  localStorage.setItem('font', 'Helvetica');
  localStorage.setItem('image', 'myCat.png');
}

ืžืคืจื˜

ืชืื™ืžื•ืช ื“ืคื“ืคืŸ

BCD tables only load in the browser

ืจืื• ื’ื