JSFiddle - React, Tailwind, and code Playground

by Plippie Plop

HTML

<div id="test">

</div>

JavaScript

var agent = "Mozilla/5.0 (iPad; CPU OS 12_4_2 like Mac OS X)";

var test = document.getElementById('test');

 start = agent.indexOf('OS');
  if ((agent.indexOf('iPhone') > -1 || agent.indexOf('iPad') > -1) && start > -1) {
    test.textContent =  agent.substr(start + 3, 4);
  }