I get this:
SyntaxError: missing ) in parenthetical
There appears to be a nested, array reference required to do this.
Are you trying to hide the item from the menu bar or close the navigation panel.
app.hideMenuItem("ShowHideFileAttachment"); // remove the file attachments from the nav panel view options;
Why not use the app object's execMenuItem method and specify the JS name of the menu item to execute?
app.execMenuItem("ShowHideFileAttachment"); // toggle the file attachment nav panel;
There is a wealth of information in the Acrobat JS API Reference manual.
It seemed strange to me that there was only a toggle option for the nav panel with no "show" or "hide" argument:
How do know if it's open ?
You do not, you can only toggle it just like the menu item does.