This code works perfectly
chrome.storage.sync.get("test", function (array){
var newArray = array["test"];
newArray.push("newValue");
chrome.storage.sync.set({"test": newArray});
});
But this code does not work
var key = "test";
chrome.storage.sync.get(key, function (array){
var newArray = array[key];
newArray.push("newValue");
chrome.storage.sync.set({key: newArray});
});
Why?