我正在尝试通过以下方式将内容保存在.FullName
中:
PS> (Get-ChildItem $PSHOME\powershell.exe) -eq (Get-ChildItem $PSHOME\powershell.exe)
False # Distinct FileInfo objects, which aren't reference-equal.
这似乎并没有保存我的值,但出现错误:
LocalStorage
感谢您的帮助!
答案 0 :(得分:0)
尝试清除localStorage并再次运行代码。如果您保存的先前值不是有效的JSON可解析对象,则它将永远不会被覆盖,因为在此之前您的代码将失败。
如果这不起作用,请尝试将localStorage
替换为window.localStorage
。
答案 1 :(得分:0)
我要做的是以下事情:
0x0800 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 # The "abcdefgh" string literal is in read-only memory at 0x8000 through 0x0808, including the 0x00 terminator byte.
0x0808 0x00 .... .... .... .... .... .... ....
0x0810 .... ... .... .... .... .... .... ....
[ Jump forward about 0x200 bytes ]
0x1000 0x00 0x00 0x80 0x00 .... .... .... .... # The `stringFromLiteral` variable has a 4-byte sized pointer to the string at 0x0800:
0x1008 .... .... .... .... .... .... .... ....
0x1010 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 # The `asUnsigned64bitInteger` value is a 64-bit value that is the same as 8 bytes copied from 0x0800, but without the terminator
0x1018 .... ... .... .... .... .... .... ....
0x1020 .... ... .... .... .... .... .... ....
确认myjson是有效的json对象。
您可以使用jsonlint来验证json对象。
答案 2 :(得分:0)
这也可能在设置本地存储时出现问题。请确保已保存要尝试在本地存储中设置的值。
如果以上内容正确,则可以继续执行以下代码:
var objJson = localStorage.getItem('tasks');
objTasks = objJson ? JSON.parse(objJson) : [];
上面的代码行将确保检索本地存储“任务”的值,如果检索到该值并且该值不为null且不为空,则仅将其解析。
>