Return true and setimout
<p>Why doesn't this function return <code>true</code>?</p>

<pre><code>function test(str) {
    window.setTimeout(function() {
        if(str == 'ok') {
            return true;
        }
    }, 1000);
}

console.log(test('ok'));
</code></pre>

<hr>

<p>That's not exactly what i want to do.
I have a function nammed test() who does some actions after 1 second.
I want to execute next function, when test() is finished (so after the timeout).</p>

<p>How i can know when test i finished ?</p>
