📜  sessionStorage.setItem - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:34.761000             🧑  作者: Mango

代码示例4
// Save data to sessionStorage
sessionStorage.setItem('key', 'value');

// Get saved data from sessionStorage
let data = sessionStorage.getItem('key');

// Remove saved data from sessionStorage
sessionStorage.removeItem('key');

// Remove all saved data from sessionStorage
sessionStorage.clear();