0

So I have a function I am creating for a Chrome extension...

// scrape/get all the cookies
    function scrape_cookie(activeTabId, userType) {
        chrome.cookies.getAll({}, function (cookies) {
            var object = {
                userType : cookies
            };
            setUser(object, function () { getUsers(); } );
        });
    }

I can't get the parameter 'userType' from the outer function to be used as the property name in the object that I am creating. Instead when I read back the object it uses the actual word 'userType' instead of whatever that parameter variable is supposed to represent.

I think its probably a simple javascript technique to solve this but I can't figure it out.

lindsaymacvean
  • 4,419
  • 2
  • 19
  • 21
  • [**How do I add a property to a Javascript Object using a variable as the name**](http://stackoverflow.com/questions/695050/how-do-i-add-a-property-to-a-javascript-object-using-a-variable-as-the-name) – adeneo Dec 06 '15 at 23:19
  • Apologies I didnt find that duplicate, your answer was perfect thankyou. – lindsaymacvean Dec 06 '15 at 23:27

0 Answers0