JSFiddle - React, Tailwind, and code Playground

JavaScript

var deviceAgent = 'Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; device Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Safari/533.1';

    var agentIndex = deviceAgent.indexOf('Android');
    if (agentIndex != -1) {
       var androidversion = parseFloat(deviceAgent.match(/Android\s+([\d\.]+)/)[1]);
       if (androidversion < 4.1)
        {
           alert(androidversion + ' I am older than JB');
        } else {
           alert(androidversion + ' I am JB and up');
        }
        } else {
      alert('I am not android');
    }