JavaScript VS Typescript:
At the starting state of web designing learning often developer recommend to new developer to learn about JavaScript to make you webpage dynamic from client side. JavaScript is one of the lightweight scripting language which is also called dynamic computer programming language but not complete OBJECT ORIENTED PROGRAMMING LANGUAGE. At the beginning stage his name was LIVESCRIPT, but Netscape change the name from LIVESCRIPT TO JAVASCRIPT, reason to relation with JAVA (programming language). As we know the old name of JavaScript is Livescript, the first appearance of it in Netscape 2.0 in 1995. In this stage the language was embedded to INTERNET EXPLORE and other web browsers.
To define the standard of it ECMA-262 define its standard version.
Working Features:
As we know without the JavaScript your website does not show the client side validation in appropriate way in simple word JavaScript provide the power in your webpage, the relation of HTML with JavaScript gives strength with respect to static and dynamic website. This working to JavaScript with HMTL provides a key advantages on webpage such as … without disturbing the server you can check client side validation in name, email and others related textboxes. Also, The JavaScript code is executed when the user submits the form, and only if all the entries are valid, they would be submitted to the Web Server. (POSTBACK AND ISPOSTBACK) JavaScript can be used to trap user-initiated events such as button clicks, link navigation, and other actions that the user initiates explicitly or implicitly.
JavaScript also provide DOM (Document Object Model), which is W3C (World Wide Web Consortium) standard its define a standard for accessing documents:
"The W3C Document Object Model (DOM) is a platform and
language-neutral interface that allows programs and
scripts to dynamically access and update the content,
structure, and style of a document."
Also, we can use JavaScript with Asp.net MVC to make your webpage fully dynamic.
TypeScript:
TypeScript is JavaScript for application-scale development.” It is an object oriented programming language, also complied language which has been design by ANDERS HEJLSBERG (also the designer of C#). TypeScript is both a language and a set of tools. TypeScript is a typed superset of JavaScript compiled to JavaScript. In other words, TypeScript is JavaScript plus some additional features.
The ECMAScript specification is a standardized specification of a scripting language. There are six editions of ECMA-262 published. Version 6 of the standard is codenamed "Harmony". TypeScript is aligned with the ECMAScript6 specification.
Working Features:
Typescript is like JavaScript, its adopts the basic blog of JavaScript. Which means to use typescript you need to know first JavaScript. All the code of TypeScript can be conveted into JavaScript code for its equivalent purpose of execution.
TypeScript Code is converted into Plain JavaScript Code.
As we consider JavaScript is typescript means that any valid .js file can be renamed to .ts and compiled with other typescript files.
It’s portable.
Also, portable across browsers, devices, and operating systems. We can run it any environment where JavaScript can run, it also dies need a dedicated VM (Virtual Machine).
Here is the code snippet of JavaScript VS TypeScript:
Some Very Basic Differences between them:
JAVASCRIPT | TYPESCRIPT |
JavaScript is a scripting language | Whereas typescript is an object oriented language |
The features of static typing is not available in JavaScript | Whereas in typescript the feature of static typing is present. |
JavaScript does not support modules. | Whereas, typescript does support modules. |
JavaScript does not support interface. | As the first comparison told us about typescript is an OOP language so therefore it support interface. |
JavaScript does not support optional parameter function | Whereas In the series of comparison TypeScript support optional parameter function |
JavaScript is subpar of typescript | Whereas Typescript is the parent of JavaScript. |
Disadvantages TypeScript over JavaScript:
§ As compare to javascript, typescript takes time to compile.
§ As we know typeScript is an object oriented language, but does not support abstract classes.