I have this function:
function SaveToStore(thisObjName) {
var thisObj = $('#'+thisObjName);
chrome.storage.sync.set({
"cbSO" : thisObj.is(':checked')
});
}
I would like to use the argument thisObjName, which contains "cbSO", as the key (property name) in the object I'm passing into chrome.storage.sync.set:
function SaveToStore(thisObjName) {
var thisObj = $('#'+thisObjName);
chrome.storage.sync.set({
thisObjName : thisObj.is(':checked')
});
}
But that's creating a property with the name thisObjName, not cbSO. How do I use the value of the argument as the key?