Javascript

From Staredit Network Wiki
Revision as of 23:32, 20 March 2015 by DevliN (Talk | contribs) (1 revision imported: Restoring SC1 backup)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

What is Javascript?

JavaScript is a scripting language most often used for client-side web development. It is a dynamic, weakly typed, prototype-based language with first-class functions. JavaScript was influenced by many languages and was designed to look like Java, but be easier for non-programmers to work with.

What does that mean?

Javascript is an easy to use coding language that is un-compiled and all that is required is notepad. Simply name any file with the extension .js and you are now able to run the file. With this and its ability to output a file with information in it, we can produce lines of code with only a few lines.

So, how easy is it?

Well, its so simple that you use it for everything -- from triggers to scripting.

First, open up Notepad and add this:

var fso = new ActiveXObject("Scripting.FileSystemObject");
var outputFileName = fso.GetParentFolderName(WScript.ScriptFullName) + "\\" + fso.GetBaseName(WScript.ScriptFullName) + ".txt";
var outputStream = fso.CreateTextFile(outputFileName, true);

Now, we can output lines to a file. Let’s just make it output “HI!” 50 times:

for(var I = 0; I<50; I++){
outputStream.WriteLine("HI!");
}

And we close the document like a good little boy:

outputStream.Close();

And its just that simple! Now, for even better results, you can move onto Tips for Tedious Coding.