title: Can't unserstand how this example work. lastIndexOf() Method
body: <p>I was looking at this example that get the name of a file after you select it in your pc. </p>
  
  <p>I writing becuase I don't understand, how in this case <code>lastIndexOf()</code> works!</p>
  
  <pre><code>&lt;script&gt;
          $('#browseFile').change(function() {
              var filename = $(this).val();
              var lastIndex = filename.lastIndexOf("\\");
              if (lastIndex &gt;= 0) {
                  filename = filename.substring(lastIndex + 1);
              }
              $('#filename').val(filename);
         });
  &lt;/script&gt;
  </code></pre>
  
  <p>I know that lastIndexOf count how many chars you have before a specified string so for example:</p>
  
  <pre><code>var phrase = "look at the sea";
  var result phrase.lastIndexOf("sea");
  </code></pre>
  
  <p>will return 13, but why in the first example I posted  <code>if (lastIndex &gt;= 0)</code> then we know the name of the file?</p>