Ever feel like your internet is running slow? Webpages seem sluggish while uploads and downloads take forever! It’s very frustrating, especially when you pay for high-speed internet.
As a developer, we need to find the current speed and load the pages accordingly. So if you want to get the connection speed in JS you can use the Navigator.connection object.
so the above example will trigger an event whenever there will be some changes in the network.
As you can see in logs whenever I changed the network type from network tab events gets fired and it printed the current connections types.