This is probably really easy but I cannot figure out how to do it:
Code JavaScript:var newObject = { 'hello': 'boo' // this is what I want }; // The word, "hello" will not always be the same, so I'll set it in a variable: var x = 'hello2'; // New object with "x" - var newObject2 = { x: 'boo' }; // ^ the above (newObject2) sets property x as "boo" (i.e. newObject.x==='boo') // I want there to be a "hello2" property (i.e. newObject2.hello2) // How can I make this happen??
Any help appreciated...





Bookmarks