According to this post from SeoProfiler JavsScript can be problemetic. They cite John Mueller of Google (and an occasional contributor here).
They provide the following four examples of hyperlinks and whether Google would typically crawl them.
This is a regular a href link that will be crawled by Google.
<a href="/good-link">Will be crawled</a>
Google will not crawl this link because it is not an anchor.
<span onclick="changePage('bad-link')">Not crawled</span>
This link is in an anchor, but it does not use the href attribute. That’s why Google won’t crawl it.
<a onclick="changePage('bad-link')">Not crawled</a>
This link will be crawled by Google because it is an anchor with a href attribute.
<a href="/good-link" onclick="changePage('good-link')">Will be crawled</a>
If you don't use
<a href=...> links, Googlebot will not be able to crawl your site. All of your pages will look like orphan pages to search engines.
<a href=foo.html onclick="load('foo');return false">
From that, search engines can find links to
false from the onclick handler prevents default action specified by the
href from happening for users.