I came across this article that talked about AJAX and jQuery and I reached this line
hash = hash.replace(/^.*#/, '');
where hash has the form # page1, # page2, etc.
Now I donβt understand why
hash = hash.replace(/^#/, '');
will not be enough. From Mozilla Docs ,
^ Corresponds to the beginning of input. If the multi-line flag is set to true, it also matches immediately after the line break character.
So, with this caret, I should be able to match the hash value, what is the author trying to do?
source share