this code takes a url as input, but I’m not sure what it does or what’s the benefit of doing this
var hashPos = url.lastIndexOf ( '#' );
return url.substring( hashPos + 1 );
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It fetches the hash value off a URL:
So, if the URL is this:
http://something.com/foo#xyz, it gets thexyzIf there is no hash mark in the URL, this code returns the entire URL (which may not be the desired outcome).
This is probably a safer variation that returns an empty string, when there is no hash value: