亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

有關JSON.stringify( )的問題

有關JSON.stringify( )的問題

慕尼黑8549860 2019-03-14 18:15:59
let knowledgeData =[];    let initialKnowledge = [        [            ["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 (let knowledge of initialKnowledge) {        knowledgeData.push(new Map(knowledge));    }    localStorage.setItem("knowledgeData", JSON.stringify(knowledgeData));遇到問題:現在將knowledgeData這個數組轉換成JSON字符串存到localStorage中,再使用JSON.parse(localStorage.getItem("knowledgeData"))取出,是空的,不知道為什么?是因為使用了Map的原因嗎?求大神解答
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 590 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號