Add a JS example for selecting the input/output audio devices from a menu

also fixes a bug in Menu.removeMenu()

closes #2470, closes #2473