title: How to fix "Uncaught ReferenceError: Cannot access 'io' before initialization" in socket.io client?
body: <p>Hi i am trying to create a basic realtime application in socket.io , i have completely setup the server side in node.js and the file "socket.io.js" is also being imported in browser but somehow when i try to connect with socket.io server using <code>let io = io()</code> or <code>let io = io.connect()</code> i get the following error.</p>
  
  <pre><code>Uncaught ReferenceError: Cannot access 'io' before initialization
  </code></pre>
  
  <p>node.js code:</p>
  
  <p><a href="https://i.stack.imgur.com/F1PQ7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F1PQ7.png" alt="enter image description here"></a></p>
  
  <p>client code:</p>
  
  <p><a href="https://i.stack.imgur.com/sRQg3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sRQg3.png" alt="enter image description here"></a></p>