Does Jscript on windows really exist?

  • Thread starter Thread starter oldtobor
  • Start date Start date
  • Tags Tags
    Windows
AI Thread Summary
JScript is indeed a scripting language available on Windows, and it can be executed from the command prompt. However, it does not support certain functions commonly found in web-based JavaScript, such as alert(). Instead, JScript utilizes WScript for output, which requires specific syntax. For example, using WScript.echo() is necessary to display output in a console environment. To run a JScript file, it should be saved with a .js extension and executed using the command line with cscript or wscript. The confusion arises from differences in syntax and functionality between JScript and other scripting languages like VBScript. Despite initial difficulties, JScript can be effectively used for scripting tasks on Windows.
oldtobor
Messages
132
Reaction score
0
does Jscript on windows really exist??

I read on various web pages that jscript can be used on windows as a scripting language directly form the DOS prompt. But I couldn't find ANY working example on the internet! even a simple alert("hello") put in a hello.js file doesn't work! It says an object is missing. Now I tried to find info on the web and after many attempts I am starting to doubt if this is just hype.

Can I really run A SIMPLE alert("www") in a hello.js file from the DOS prompt without any errors ? does this jscript thing really exist ?

(I also tried c:> cscript hello.js and others but to no avail... Thanks if anyone knows anything about this.
 
Computer science news on Phys.org
Problem is the exact case of the string WScript.

(notice the WS...)


var a=new Array(10000);

for(i=1;i<10000;i++)a="www"+i;

WScript.echo (a[4877]);

for(i=999;i<1010;i++) WScript.echo (a);


It seems that some syntax is invented just to confuse; in vbs all cases work, in js not so, maybe to discourage a newbie to use js ... and then why didn't they maintain the alert() function ?

Anyways you can use this quick and dirty programming language on any PC right off the bat, just save the program as .js and run from the command line.
or run as cscript hello.js to see results as console.
 
In my discussions elsewhere, I've noticed a lot of disagreement regarding AI. A question that comes up is, "Is AI hype?" Unfortunately, when this question is asked, the one asking, as far as I can tell, may mean one of three things which can lead to lots of confusion. I'll list them out now for clarity. 1. Can AI do everything a human can do and how close are we to that? 2. Are corporations and governments using the promise of AI to gain more power for themselves? 3. Are AI and transhumans...
Sorry if 'Profile Badge' is not the correct term. I have an MS 365 subscription and I've noticed on my Word documents the small circle with my initials in it is sometimes different in colour document to document (it's the circle at the top right of the doc, that, when you hover over it it tells you you're signed in; if you click on it you get a bit more info). Last night I had four docs with a red circle, one with blue. When I closed the blue and opened it again it was red. Today I have 3...
Back
Top