jjzjj

userKeyIds

全部标签

javascript - 使用 chrome.storage.local 存储数组

我正在编写一个chrome扩展程序,但无法存储数组。我读到我应该使用JSONstringify/parse来实现这一点,但我在使用它时遇到了错误。chrome.storage.local.get(null,function(userKeyIds){if(userKeyIds===null){userKeyIds=[];}varuserKeyIdsArray=JSON.parse(userKeyIds);//HereIhaveanUncaughtSyntaxError:UnexpectedtokenouserKeyIdsArray.push({keyPairId:keyPairId,Ha