title: Determining if a property is a getter or setter (or both) in JavaScript
body: <p>Is there a convenience method in ES5 to determine whether a property is a getter or setter, or is the following idiomatic?</p>
  
  <pre><code>var o = {
    get foo() { return 'foo'; },
    set bar(value) {},
    bam: 'bam',
  };
  
  function isGetterOrSetter(o, k) {
    var descriptor = Object.getOwnPropertyDescriptor(o, k);
    return !!(descriptor.get || descriptor.set);
  }
  
  isGetterOrSetter(o, 'foo'); // true
  isGetterOrSetter(o, 'bar'); // true
  isGetterOrSetter(o, 'bam'); // false
  </code></pre>