How to Check the Runtime and Memory Usage of a Specific Function in Python and Javascript in VS Code?

Im working on optimizing my code and would like to monitor the runtime and memory usage of specific functions in both Python and JavaScript while using Visual Studio Code as my IDE.

Are there extensions, libraries, or built-in function that can help with this?