JSFiddle - React, Tailwind, and code Playground
JavaScript
console.clear();
function getPPI(){
var div, body, ppi;
div = document.createElement("div");
div.style.width="1in";
body = document.getElementsByTagName("body")[0];
body.appendChild(div);
ppi = document.defaultView.getComputedStyle(div, null).getPropertyValue('width');
body.removeChild(div);
return parseFloat(ppi);
}
var d = Math.floor( Math.sqrt( Math.pow(window.screen.height,2) + Math.pow(window.screen.width,2) ) / getPPI() );
console.log(d);