Google can crawl, index, and rank generated JavaScript content. But ... it uses the old version of Chrome (42) with the old JavaScript rendering engine.
The consequence of this is that your JavaScript code should work in older browsers and older versions of Chrome (older than 42). So no unusual ES6 features, you need to use polyphiles or Babel, for example.
Although you can do a lot with javascript (for example, click events or implementing a mobile menu), it is recommended that you still use a-href instead of the javascript event button, and then use the function to go to a new page.
You can check the mobile testing tool on Google: https://search.google.com/test/mobile-friendly and check for errors / warnings / logs. If the rendering result looks as intended, Google will see your content.
In the search console, you can also ask to index the page. Sometimes a javascript scanner is the first, sometimes a “classic” scanner.
Check it out a few days later, using the help of a sentence or paragraph from your page.
There is no answer as to whether this is better or not. Content is content, and Google must rank your site, SPA, PWA, AMP site, PDF document, online document, wiki page, etc. Depending on their content, and not on the underlying technology.
If you are familiar with JavaScript, try it.
Regards, Peter