JSFiddle - React, Tailwind, and code Playground

JavaScript

// js start
console.log('js start');

var hash = {
    'set' : function(val){
        console.log('Value was set to: '+val);
        window.location.hash = val;
    },
    'log' : function(){ 
        console.log('Hash log: '+ window.location.hash);
    },
    'bind': function(){
        console.log('Bound when hash was: '+window.location.hash);
        $(window).bind('hashchange', this.log);
    }
};

// set
hash.set('hash0');
hash.set('hash1');
hash.set('hash2');
hash.set('hash3');

// bind
setTimeout(hash.bind,0);

// js end
console.log('js end');