猿问

有关JSON.stringify( )的问题

letknowledgeData=[];
letinitialKnowledge=[
[
["id",1],
["title","关于float的那些事儿"],
["URL","http://www.w3school.com.cn/cssref/pr_class_float.asp"],
["progress",100],
["evaluation",3],
["notes","关于float的那些事儿关于float的那些事儿关于float的那些事儿关于float的那些事儿关于float的那些事儿关于float的那些事儿"],
["tags",["1","2","3"]]
],[
["id",2],
["title","position知多少"],
["URL","http://www.w3school.com.cn/cssref/pr_class_position.asp"],
["progress",75],
["evaluation",4],
["notes","position知多少position知多少position知多少position知多少position知多少position知多少position知多少position知多少position知多少"],
["tags",["1","2"]]
],[
["id",3],
["title","1211gfdhfnndhdfhdfgfd"],
["URL","http://www.w3school.com.cn/cssref/pr_class_position.asp"],
["progress",66],
["evaluation",2],
["notes","gfgitiongdfgfdh42356576654435u6uyuydhfjyrdjfjyrdhhvjtdyrdhhmvjdhhmvhthhgchvjyhmhvjyhdgmhvhyedtjfhjyyedtjykkfuuysjx"],
["tags",["2","3"]]
]
];
for(letknowledgeofinitialKnowledge){
knowledgeData.push(newMap(knowledge));
}
localStorage.setItem("knowledgeData",JSON.stringify(knowledgeData));
遇到问题:现在将knowledgeData这个数组转换成JSON字符串存到localStorage中,再使用JSON.parse(localStorage.getItem("knowledgeData"))取出,是空的,不知道为什么?是因为使用了Map的原因吗?求大神解答
一只萌萌小番薯
浏览 266回答 2
2回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答