JSFiddle - React, Tailwind, and code Playground JavaScript var domain = window.location.hostname.split('.'); alert(domain[domain.length - 2]);