Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How execute JS

How execute JS

How execute JS

I am have a basic understand of JS and I have worked with VB Script quite a bit so I am familiar with scripting languages.

I have decided to explore my knowledge of JS further. Of course, there are lots of examples and articles.

The basic question I have is what is the best way for me to create and execute JS code from a Windows PC? At this point I am just looking to do simple things like define and assign variables and arrays and then iterate though them and display the values and latter progress to IF/ESLE & CASE as well as response text boxes.

Any tips for getting started?


RE: How execute JS

There is no best way to create a script on a PC. Some will use fancy editors like Visual Studio Code, some will just use notepad. If you are still using office 2000, it contains the Microsoft Script Editor, which was brill as a js or vbs IDE. Unfortunately, MS withdrew it from office 2003 onwards citing it was hardly used. Pretty lame reason - if you don't tell anyone it is there, of course nobody will use it.

Executing the code is the same as VBS

cscript xxx.js

Like VBS, if you have echo statements and you use

wscript xxx.js

all the echo statements will appear as message boxes which you have to OK.

It has some features which are similar to vbs - js is JScript: not really Javascript. It is case sensitive on some bits but not on others. For instance,


wscript.echo("Does not work - wscript undefined")
WScript.echo("This works")
WScript.Echo("As does this")
WScript.ECHO("And this") 

One of the problems with jscript and javascript examples is many of the coders love using nameless functions. Very often, you need to take the code apart to figure out what is happening. Unless you can work out what the nameless functions are doing, it can get very difficult to decipher the code. Instead of


function add(x,y) {
    return x + y
z = add(20, 25) 

they would rather write


z = function (x, y) {
    return x + y

The authors don't normally comment their nameless function code so you may have a nice time trying to figure out what it is doing. Think very hard about "will I understand this when looking at it in a year's time" before you go down the nameless function route.

You can embed your code in a WSF file. This will allow you to have both js and vbs bodies. You can execute either or both. Great for translation which allows you to run both scripts.

One of the advantages of js is it is a transferable skill. You can write customised code in Office 365, Google Apps Script (GAS) and web code.

RE: How execute JS

Thanks for the response. I am hoping to find lightweight IDE. I have used .NET in the past but don't currently have it installed and would prefer not to unless I have to. I did a google search and found a few but don't know the difference between a good one and a bad one.

Temporarily, I have been using HTML but I am looking for something better.


<title>Test Program</title>

<script language = "javascript" type = "text/javascript">
document.write("Hello World!")


RE: How execute JS

You could try

  • Visual Studio Code - quite light weight with a lot of the Visual Studio goodies thrown in. This can cope with the mix of html and jscript/vbscript and you can set breakpoints
  • Geany - takes a while to start. This is basically a multi-language editor like VSCode. I've never used it for debugging.
  • Codelobster - started life a a php editor and evolved from there.
All 3 are used by both Windows and Linux users so there is quite a lot of help out there if you ever get stuck.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close