Make button disapper if hash equals firstpage

So, I’m using fullpage.js jquery for scrolling on my website.
Each scroll section is divided in hashes, like index.html/#firstPage etc.
I’ve made a fixed scroll to top button, but I wanna make him disappear if hash equals #firstPage.
I’ve made a Js script too, but it doesn’t work. Any ideas?

mybutton = document.getElementById("scroll_top_button");

var stringHash = window.location.hash;
console.log(stringHash); // Returns hash and it works
function hashDisappear() {
  if (stringHash == "#firstPage") {// this thing doesn't work at all.
    mybutton.style.display = "none";
  } else {
    mybutton.style.display = "block";
  }
}