Testing Javascript From The Command Line

One of my goals for 2018 is to take a part time full stack development course. I want to hit the ground running on day 1 so I recently signed up for a javascript and web development course on Udemy. As part of the Javascript course the instructor provides a number of labs and illustrates each concept with code snippets. When I was learning Python several years ago I found it extremely useful to fire up a python shell to test functions and new modules. The node command shell provides a similar experience and can be installed on a Fedora-derived distribution with dnf:

$ sudo dnf install nodejs

Once nodejs is installed you can run node to access the interactive command shell:

$ node

> var a = 1;
> var b = 2;
> gorp = a + b;

This appears to work identically to the python shell and makes it a snap to test new code.

This article was posted by Matty on 2017-11-28 11:14:07 -0500 EST