I am not able to understand how exactly the chrome.storage.sync.get
function works.
Usual Scenario:
chrome.storage.sync.get(["color", "colortwo"], function(colors) {
changeColor.style.backgroundColor = colors.colortwo
});
Special Scenario:
chrome.storage.sync.get(["color", "colortwo"], function({colortwo}) {
changeColor.style.backgroundColor = colortwo;
});
I am not able to understand how specifying function({colortwo})
is able to let us access the colortwo variable directly since chrome.storage.sync.get
is supposed to return an object containing all of our data
Would love some insights as to how exactly Javascript handles this special case so that I can gain a deeper understanding. Thanks!