One Nice and Easy Way to Test JavaScript Concepts

If you are an application developer, there is a high possibility that you develop web applications.  As such there is a high probability that you will run into a situation where you need to test some JavaScript concepts.  There are official ways to run JavaScript unit tests.  But that's not what I am referring to here.  Sometimes you just need to test how something works in JavaScript. 

Recently I wanted to test what JavaScript with types that were undefined.  Rather than run the application, I wanted to run some simple JavaScript code.  Most you already know this but it's worth mentioning anyway, in case you don't.  You can test out many concepts right from the command line using node.  But not just from you DOS command line, from your node command line,  the REPL (Read Eval Print Loop).

First you have to install node.  You can find out how to install it from the official node website.

Once you have install node and configure it.  You can begin running JavaScript right from your command line as can be seen in the following screenshot.


In the screenshot above you see how I entered my commands directly into the command line. First I ran the node command which opens the command prompt and then I started writing some simple JavaScript code.  This was not my actual code I was testing though.  The sample above is just to show a sample of the node command line.

This is an easy way to test JavaScript concepts without the overhead of running your actual application or running it in the browser.

Sometimes you just need to test some basic concepts and for that, node is a great tool even if you are not creating or maintaining node web applications.

I've seen Derick Bailey do some amazing proof of concepts and poking and probing JavaScript using node.  He's pretty awesome at doing this.  When he doesn't understand something about the language he usually probes it with the node command line to get a closer look.  Check out his website at watchmecode.net to see some of the amazing things he does with the node command line.  You can subscribe and really accelerate your JavaScript skills. He also has some free videos and you can check those out (your may have to search youtube for them or on his site). And no he didn't pay me to advertise his website.  I have learned a lot from watching him use the node command line and I truly believe that it will help you accelerate your understanding of JavaScript.  I am only sending you there because he can do a much better job at demonstrating what I am referring to on this post.

Comments

Popular posts from this blog

Simple Example of Using Pipes with C#

Why I Hate Regular Expressions

Putting Files on the Rackspace File Cloud