title: How can I find out all the methods on a JXA object?
body: <p>I'm trying to list all the methods of a JXA object. I've tried several methods that work with JavaScript in the browser, but none have worked:</p>
  
  <pre><code>&gt;&gt; Object.getOwnPropertyNames(Application('Finder').selection()[0]);
  =&gt; ["__private__"]
  &gt;&gt;
  &gt;&gt; JSON.stringify(Application('Finder').selection()[0])
  =&gt; undefined
  &gt;&gt;
  &gt;&gt; console.dir(Application('Finder').selection()[0])
  !! Error on line 1: TypeError: console.dir is not a function. (In 'console.dir(Application('Finder').selection()[0])', 'console.dir' is undefined)
  &gt;&gt;
  &gt;&gt; for(var m in Application('Finder').selection()[0]) { console.log(m); }
  =&gt; undefined
  &gt;&gt;
  &gt;&gt; console.log(Application('Finder').selection()[0])
  2017-01-27 16:51:16.331 osascript[18617:633276] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFStringappendString:]: nil argument'
  *** First throw call stack:
  (
          0   CoreFoundation                      0x00007fff77feb0db __exceptionPreprocess + 171
          1   libobjc.A.dylib                     0x00007fff8cc7da2a objc_exception_throw + 48
          2   CoreFoundation                      0x00007fff780689c5 +[NSException raise:format:] + 197
  ####### SNIPPED FOR BREVITY ########
          45  Foundation                          0x00007fff799944ea -[NSRunLoop(NSRunLoop) run] + 76
          46  osascript                           0x000000010d4e0485 osascript + 9349
          47  libdyld.dylib                       0x00007fff8d55f255 start + 1
  )
  libc++abi.dylib: terminating with uncaught exception of type NSException
  /Users/example/Tools/my-tools/osascript: line 24: 18617 Abort trap: 6           reattach-to-user-namespace /usr/bin/osascript "$@"
  </code></pre>
  
  <p>How can I get a list of all the methods that JXA object has?</p>