Javascript (NodeJS) promise pending?
<pre><code>function  f () {
   return new Promise(function (resolve, reject) {

        resolve(4);
    })
}

function  g () {
    return f().then((res) =&gt; {return res;})

}

console.log(g());
</code></pre>

<p><strong>This returns</strong> <code>Promise { &lt;pending&gt; }</code></p>

<p>If I returned <code>res</code>(in the then) and then returned <code>f()</code>, why isn't the output <strong>4</strong>?</p>