JavaScript is turing complete so of course it can be done. The real question you're asking is, can it be done in a web app? I think the answer is I think "no" because web apps aren't allowed to make raw TCP socket connections.
Now there may be a way around that by using browser-specific things like extensions or "installable apps" which give your code greater access permissions. This approach means you essentially use Chrome as your app platform instead of a JVM, the assumption presumably being that more users have Chrome than a JVM. The flip side is that users who don't would probably balk at the idea of installing an entire browser in order to run a wallet app, whereas a JVM can be bundled and the resulting app acts like any other. I don't know of a convenient way to "statically link" Chrome into a regular-looking application.
I personally wouldn't find such a design compelling. Whilst Java isn't exactly a great language, JavaScript is significantly worse in virtually all aspects. I don't understand why anyone would want to use JavaScript outside the browser - you get less safety, less performance, fewer features, less mature tools and so on. If the end result is an installable app like any other, all you did is cripple yourself vs the competition that's using languages/platforms designed for it.