How to run Javascript exercises locally?

So I know how to run c# exercises in VS or linqpad. What setup do I need to run javascript code and tests?

I’ve downloaded the exercise locally and opened in VScode. Do I need an additional compiler to run the tests? Thanks!

The “Installing” and “Testing” docs on the Javascripts Docs page are pretty command line focused. @SleeplessByte are there any IDE-focused docs for javascript?

There aren’t any at the moment, but in general, in the JavaScript ecosystem, majority of people will run “package.json scripts” in the command-line.

To answer the question at hand: you want to press terminal at the bottom of the screen (or open one via the top menus) and make sure you’re inside an excercises directory.

You are inside an exercise directory if ls (Linux / Mac / git bash for Windows) or dir (Windows) returns a line that says package.json. Use cd abc to go into a directory if you’re not, or right click on the package.json file on the left side file tree and select “open terminal here”.

Finally you’ll want to run npm install to install the dependencies. The tests can be ran in the same way as documented.

You can do cool things like using the vs code debugger to step through your code, let me know if you need help setting that up.

1 Like