title: Javascript - Read value of a JSON property, if that key doesn't exist return null, in a single line
body: <p>Let me give a python analogy of what I am looking for:</p>
  
  <pre><code>fruits_dict = {"banana": 4, "apple": 3}
  num_apples = fruits_dict.get("apple", None)
  num_oranges = fruits_dict.get("orange", None)
  print(num_apples, num_oranges)
  </code></pre>
  
  <p>prints:
      3 None</p>
  
  <p>Now in Javascript, with a similar JS object, we can use <code>hasOwnProperty(key)</code> in a <code>if</code> block</p>
  
  <pre><code>var fruits_obj = {"banana": 4, "apple": 3};
  var num_apples = null;
  if (fruits_obj.hasOwnProperty("apple")) {
      num_apples = fruits_obj["apple"];
  }
  var num_oranges = null;
  if (fruits_obj.hasOwnProperty("orange")) {
      num_oranges = fruits_obj["orange"];
  }
  console.log(num_apples, num_oranges);
  </code></pre>
  
  <p>gives:
      3 null</p>
  
  <p>Is there a better way? Something on the lines of python's <code>get</code> function?</p>