What you want is to use a Language Server through the Language Server Protocol (LSP).
Read more about it on Wikipedia or on the official website.
As the Wikipedia article points out:
The Language Server Protocol was originally developed for Microsoft's Visual Studio Code and is now an open standard.
So what you get in VS Code is actually being backed by a language server. (In other words, at least in theory, all that information can be available to Vim as well.)
Things get a little more murky as you explore using LSP from Vim, since there are many competing plug-ins that can use an LSP (many with different levels of support, or different sets of features.) So you'll have to try them out and see which ones work best for you.
You can find a list of those plug-ins for Vim at the official LSP website. Probably worth checking are vim-lsp and LanguageClient-neovim, which were developed specifically for supporting the Language Server Protocol.
But you'll see other Vim plug-ins such as coc.nvim and ALE, which predate LSP or started with a different approach have also added support for LSP, so looking into those (and particularly LSP integration from them) might be worth it.
Finally, if you're using LSP, you'll also need a language server for your particular language (JavaScript in your case.) See the list of language server implementations for some you might want to try.
This is a fairly new area and there are quite a few moving parts, so expect it'll take quite a bit of experimentation, some research, you might find poor or lacking documentation and it's possible the end result is still far from what you expected. But this will be as close from VS Code as you can get, since in the essence that's what VS Code actually uses.