JSFiddle - React, Tailwind, and code Playground

JavaScript

var url = document.createElement('a');
url.href = 'http://stackoverflow.com/questions/ask?a=1&b=2';
alert(url.pathname + url.search);