title: Invoke a method in an Object that was created inside a function
body: <p>I am confused by this question and not even the JavaScript MDN is clarifying the concept for me. </p>
  
  <p>There is a function called invokeMethod and in that function I have to create an Object. The Object includes a Method. I need to invoke the Method in the Object using bracket notation but nothing needs to be returned.</p>
  
  <p>Here is the Question and my code. I keep getting error messages when I try to call the method in the function parentheses.</p>
  
  <p>Question: method is a string that contains the name of a method on the object
  Invoke this method using bracket notation.
  Nothing needs to be returned.</p>
  
  <p>Input Example:</p>
  
  <pre><code>{ foo: function() {} }, 'foo'
  </code></pre>
  
  <p>My code: </p>
  
  <pre><code>function invokeMethod(object, method) {
    // code here
    const obj = {
      name: 'kung',
      foo: function(){
        console.log('foo');
      }
    };
  }
  
  invokeMethod(obj[foo]);
  </code></pre>