How to detect the user browser ( Safari, Chrome, IE, Firefox and Opera ) using JavaScript ?

Example:

        function checkBrowser() {
          
            // Get the user-agent string
            let userAgentString = 
                navigator.userAgent;
          
            // Detect Chrome
            let chromeAgent = 
                userAgentString.indexOf("Chrome") > -1;
          
            // Detect Internet Explorer
            let IExplorerAgent = 
                userAgentString.indexOf("MSIE") > -1 || 
                userAgentString.indexOf("rv:") > -1;
          
            // Detect Firefox
            let firefoxAgent = 
                userAgentString.indexOf("Firefox") > -1;
          
            // Detect Safari
            let safariAgent = 
                userAgentString.indexOf("Safari") > -1;
                  
            // Discard Safari since it also matches Chrome
            if ((chromeAgent) && (safariAgent)) 
                safariAgent = false;
          
            // Detect Opera
            let operaAgent = 
                userAgentString.indexOf("OP") > -1;
                  
            // Discard Chrome since it also matches Opera     
            if ((chromeAgent) && (operaAgent)) 
                chromeAgent = false;
          
            document.querySelector(".output-safari").textContent
                        = safariAgent;
            document.querySelector(".output-chrome").textContent
                        = chromeAgent;
            document.querySelector(".output-ie").textContent
                        = IExplorerAgent;
            document.querySelector(".output-opera").textContent
                        = operaAgent;
            document.querySelector(".output-firefox").textContent
                        = firefoxAgent;
        }

Git command with explanation

𝟭.𝗴𝗶𝘁 𝗱𝗶𝗳𝗳: Show file differences not yet staged. 𝟮. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 -m "commit message": Commit all tracked changes ...

Best for you