JSFiddle - React, Tailwind, and code Playground

JavaScript

var urls = [
    'http://stackoverflow.com',
    'http://stackoverflow.com?foo=bar',
    'http://stackoverflow.com/',
    'http://stackoverflow.com/?foo=bar',
    'http://stackoverflow.com/qux',
    'http://stackoverflow.com/qux?foo=bar', 
    'http://stackoverflow.com/qux/',
    'http://stackoverflow.com/qux/?foo=bar',
    'overflow.com/#test',
];

if (!url.match(/\#\$/)) {
    url - '/';
}

$('body').html(url);