title: Determine if path is valid javascript
body: <p>I have a path which is passed down to me as a javascript variable, which will reference to an image (maybe).
  <code>../app/assets/icon.png</code>. In the case that the path is invalid or doesn't exist, I want to use a different file, located somewhere else. In the end, it should look something like this:</p>
  
  <pre><code>var verifiedPath = existsAndIsValid(path) ? path : '../app/default/icon.png'
  </code></pre>
  
  <p>Is there a simple one-liner in which I can do this? </p>