title: How to check if value exists in an object in JavaScript
body: <p>I have a function in my angular factory service to fetch some data. How do I check that a certain value exists inside the object before using it?</p>
  
  <p>here is what I've been trying...</p>
  
  <pre><code>categories.fetch = function(app){
    if(!app.subject.name.length){
      return false;
    }
    var p = Restangular.all('v1/categories').getList({app.subject.name.toUpperCase()});
  }
  </code></pre>
  
  <p>so I just want to check that there is value in <code>app.subject.name</code> before using it in the <code>restanguar</code> call...</p>
  
  <p>Thanks</p>