此代码完美无缺
chrome.storage.sync.get("test", function (array){
var newArray = array["test"];
newArray.push("newValue");
chrome.storage.sync.set({"test": newArray});
});
但是这段代码不起作用
var key = "test";
chrome.storage.sync.get(key, function (array){
var newArray = array[key];
newArray.push("newValue");
chrome.storage.sync.set({key: newArray});
});
为什么?