Get number from string
window.location.pathname.match(/\d+/); // array window.location.pathname.match(/\d+/)[0];