# JSON.xx / localStorage

```
const deepCLone = structuredClone(original);
```

| Method           | Description |                                                     |
| ---------------- | ----------- | --------------------------------------------------- |
| JSON.parse()     | 字串轉物件       | `JSON.parse('{"a":1}') // {a: 1}`                   |
| JSON.stringify() | 物件轉字串       | `let obj = {a: 1} JSON.stringify(obj) // '{"a":1}'` |
|                  |             |                                                     |



localStorage / SessionStorage

| Method                           | Description   |   |
| -------------------------------- | ------------- | - |
| localStorage.set("name", "內容")   | 內容只能是字串       |   |
| localStorage.get("name")         |               |   |
| sessionStorage.set("name", "內容") | browser 關閉就沒了 |   |
| sessionStorage.get("name")       |               |   |
