title: Specify parameters for menu functions
body: <p>This is a snippet in the Google Apps Script for adding a menu in <a href="https://developers.google.com/apps-script/guides/menus" rel="noreferrer">Google Docs/Forms/Sheets</a>. As stated in the <code>Menu#addItem</code> method it calls the <code>menuItem2</code> function, but the snippet didn't include a sample on how to call the <code>addItem</code> when you want to add parameters in function call, or is this not possible?</p>
  
  <pre><code>function onOpen() {
    var ui = SpreadsheetApp.getUi();
    // Or DocumentApp or FormApp.
    ui.createMenu('Custom Menu')
      .addItem('First item', 'menuItem1')
      .addSeparator()
      .addSubMenu(ui.createMenu('Sub-menu')
        .addItem('Second item', 'menuItem2'))
      .addToUi();
  }
  
  function menuItem2() {
    SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
       .alert('You clicked the second menu item!');
  }
  
  function menuItem2(PARAMETER_HERE) {
    // codes    
  }
  </code></pre>