In case of Perl files you have to help “the mode” by creating a TAGS file beforehand through running “etags …”.
In case of JavaScript files it works out of the box and w/o etags or anything like that.
I have been using Emacs (and VI) for dozens of years now, but I did not really bother using that feature – my tactile, typing and editor capabilities are good enough to get around w/o find-tag.
But now somebody at work sort of kept nagging, how to achieve that, so eventually I looked it up. And I am glad I did. And also to find out the differences.