开发者

How do you set up your JScript (NOT JScript.NET) development environment?

开发者 https://www.devze.com 2022-12-24 23:02 出处:网络
In my environment, if I create a class in JScript syntax: class test{ } and then save it to a file named \"test.js\" and run it with wscript, I get a Microsoft JScript \"Syntax error\" at line 1.

In my environment, if I create a class in JScript syntax:

class test{

}

and then save it to a file named "test.js" and run it with wscript, I get a Microsoft JScript "Syntax error" at line 1.

However, if I simply, say, write a function:

  function getInput() {

   var wshell = WScript.CreateObject("WScript.Shell");
   wshell.Popup ("Do you want to continue?");

 开发者_StackOverflow社区  return userInput
}

getInput()

and run it the same way, it works.

Hopefully, there is something fundamentally wrong with my class definition. If that is the case, I am excited to find out.


JScript is just Microsoft's implementation of JavaScript/ECMAScript. As such, it doesn't have classes, or any of the other things added to JScript.NET to make it kinda-sorta fit into .NET.

Ignore JScript.NET, and read up on the WSH version of JScript.

0

精彩评论

暂无评论...
验证码 换一张
取 消