I'm getting a different value from what I expect when accessing to an
object's property
I'm having a trouble with getting access to an object's property.
I'm able to get access to an object's property, but I get a different
value from what I expect.
This is the code I'm working on right now.
alertHeading.on('blur', function(){
var inputtedVal = $(this).val();
var key = alertMode.val();
chrome.runtime.getBackgroundPage(function(backgroundPage) {
var background = backgroundPage.background;
var alertObject = background.getStorage(key);
alertObject.heading="aaa";
alertObject.heading[0]="zero";
alertObject.heading[1]="one";
(1)This works fine.
console.log(alertObject); //outputs Object {heading: "aaa"}
(2)These don't work as I expect.
console.log(alertObject.heading[0]); // outputs a. I'm expecting
"zero".
console.log(alertObject.heading[1]); // outputs a. I'm expecting "one".
});
})
How am I able to get access the value I set in the line where I write "to
"alertObject.heading[0]"?
Please help me out to solve this problem. Thanks!
No comments:
Post a Comment