javascript written by ruby developer. needs refactoring
<p>I came across following code</p>

<pre><code>function currentSlideFromParams() {
  var result;
  if (result = window.location.hash.match(/#([0-9]+)/)) {
    return result[result.length - 1] - 1;
  }
}
</code></pre>

<p>It is clear that this code is written by a ruby developer. However what is ruby idiomatic is not necessarily JavaScript idiom. Secondly the code complains when I run through Jslint because it warns about having an assignment inside conditional check.</p>

<p>Please suggest refactored code that is as per JavaScript idiom.</p>
