Cannot assign value to variable by reference in Javascript : <p>I would like to assign value to the variable IMLoginReq inside a ProtoBuf load function, but its not working, can anyone help?</p>

<pre><code>var IMLoginReq;
protobuf.load("./pb/IM.Login.proto", (err, root) =&gt; {
    // Obtain a message type
    IMLoginReq = root.lookup("IM.Login.IMLoginReq");
    console.log(IMLoginReq);//&lt;== is not undefined
});
console.log(IMLoginReq);//&lt;== is undefined
</code></pre>
