title: Assigning Value to Specific Object Key in Javascript
body: <p>I am trying to assign a value to a specific key in javascript named "AAPL".</p>
  
  <p>However, when I assign this value, all my keys are getting assigned the same value.</p>
  
  <p>My code below shows how I construct the object and assign the string value to [key].ticker.</p>
  
  <pre><code>var Underlying = [
    "FB",
    "AAPL"
    // ,
    // "AMZN",
    // "NFLX",
    // "GOOG",
    // "TWTR",
    // "BABA",
    // "TSLA",
    // "AMD",
    // "INTC",
    // "MSFT",
    // "RY",
    // "CM",
    // "BNS",
    // "TD",
    // "BMO"
  ];
  
  const innerobj = {
    ticker: "",
    bidtype: "",
    asktype: "",
    price: "",
    size: "",
    timestamp: ""
  };
  
  const obj = Underlying.reduce(
    (o, key) =&gt; ({
      ...o,
      [key]: innerobj
    }),
    {}
  );
  
  obj["AAPL"].ticker = "AAPL";
  console.log(obj);
  </code></pre>
  
  <p>However, the result I get is this:</p>
  
  <pre><code>{ FB:
      { ticker: 'AAPL',
        bidtype: '',
        asktype: '',
        price: '',
        size: '',
       timestamp: '' },
     AAPL:
     { ticker: 'AAPL',
        bidtype: '',
        asktype: '',
        price: '',
        size: '',
        timestamp: '' } }
  </code></pre>
  
  <p>I have tried many things. I appreciate any help or guidance. Thank you.</p>