JSFiddle - React, Tailwind, and code Playground
JavaScript
var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
connection.effectiveType;
let connectionType = connection.type || "No mobile";
alert(`${connection.effectiveType}, ${connectionType}`);