Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
JScript .NET
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Language differences == The following are prime examples of language differences between JScript .NET and other .NET languages, including comparisons. === Differences with C# === * JScript .NET does not require a [[Main function (programming)|main()]] [[function (programming)|function]] that the operating system must call directly when executing a JScript .NET application, as such, JScript .NET program flow can be based on global code. * JScript .NET, because of its very loose type checking system can be very easy to learn, since the convention of explicit type declaration is not required at all. * JScript .NET does not require explicit references to the .NET Framework Base Class Library, as certain functions found in earlier versions of JScript are present in JScript .NET (e.g. functions for finding the [[Trigonometric function|tangent]] of an angle for a [[right triangle]]). * JScript .NET is closely linked to [[C syntax]], and is thus very easy to learn for [[C Sharp (programming language)|C#]], [[Java (programming language)|Java]] or [[C++]] developers. * While JScript .NET can be used to create Windows Forms applications, JScript .NET will have some trouble, as delegates can only be consumed in JScript .NET and not created. Thus, custom events are hard to emulate in JScript .NET. === Differences with C++ === * JScript .NET does not require a [[Main function (programming)|main()]] [[function (programming)|function]]. * JScript .NET does not require explicit [[type declaration]] on variables. (In [[C++]], the use of templates and generics can be compared to this, loosely emulated with template specialization, etc.) * JScript .NET also does not require explicit [[Type conversion|type casts]] on variable use in the program. Code used to retrieve a string of characters, but only used for integer numbers can be cast implicitly; the vice versa can be done without error at compile time, but there is a chance of loss of precision or data. e.g.: <syntaxhighlight lang="javascript"> import System; Console.WriteLine("Hello, what's your name?"); Console.WriteLine("Type your name: "); var _name = Console.ReadLine(); Console.WriteLine("Hello, " + _name); </syntaxhighlight> === Differences with Java === * JScript .NET syntax and [[lexical conventions]] are similar to [[Java (programming language)|Java]] in that both are derived from [[C (programming language)|C]]. JScript was originally Microsoft's implementation of [[ECMAScript]], which is more commonly known as [[JavaScript]], though it is unrelated to Java. Thus, users of Java and other C-derived languages will find JScript easier to learn. * JScript .NET allows developers to use [[Variable (computer science)#Typing|untyped variables]], and can sometimes infer their type from their usage to optimize the compiled code. On the other hand, Java requires all variables to be typed. * JScript .NET can add properties and methods to objects in [[Run time (program lifecycle phase)|run-time]], while Java objects always conform to their declared interface. * JScript .NET supports [[global variables]], something Java does not. === Differences with older versions of JScript === * JScript .NET allows developers to declare variables and functions with type information (e.g., '''var x : String;'''), while type information for JScript's variables and functions can not be declared (e.g., '''var x;'''). * JScript .NET scripts are not interpreted, but executed independently. When executed, a JScript .NET application will invoke the [[Common Language Runtime|CLR]]. The CLR will execute the [[Common Intermediate Language|CIL]] instructions without using an interpreter. * JScript .NET can be run without the presence of a browser or another [[Scripting language|scripting engine]] as the compiler can generate standalone [[executable]]s and assemblies. However these still require [[.NET Framework]] to be installed in order to run. * JScript .NET provides access to the .NET Framework BCL ([[Base Class Library]]), providing much more functionality. * JScript .NET is only available as a scripting language for [[ASP.NET]], the technology used to generate web pages; thus, JScript .NET takes a similar role to [[PHP]] and other server-side scripting languages. Internet Explorer, however, is still using only the older JScript engine, so JScript.NET cannot be used to script web pages (or [[HTML Application|HTA]]s or HTCs). In this regard, JScript is much more versatile than JScript .NET.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)