Uncategorized

Javascript versus Typescript

JavaScript and Typescript: these are types of programming languages.

Javascript:

This is a scripting language that helps you create interactive web pages. It follows rules of client-side programming, so it runs in the user’s web browser without the need of any resources from the web server. Javascript is single-threaded, although there is a web worker API that does multithreading, and there are events, asynchronous function calls, and callbacks. JavaScript also supports functional programming including closures, recursion, and anonymous functions.

Typescript:

 Typescript is a modern-age JavaScript development language. It is a statically compiled language to write clear and simple javascript code. It can be run on Node js or any browser which supports ECMAScript 3or newer versions. Typescript adds optional types, classes and modules to javascript and supports tools for large-scale JavaScript applications for any browser, for any host, on any OS.

Why choose JavaScript

  • Allows cross-compilation.
  • Adds support for classes, as well as interface and modules.
  • Compiled JavaScript can run in any browser.
  • Specially designed tool for small script.
  • Open-source with Microsoft’s patronage.

Why choose Typescript

  • It is a superset of JavaScript.
  • Allows better development time tool support.
  • It can extend the language beyond the standard decorators, async /await.
  • It is an optionally typed scripting language.
  • Typescript code can be converted into plain Javascript code.

 

Typescript

Javascript

Year of first release

2012 1995

Designed by

Microsoft Brendan Eich / Netscape

Definition

Superset of the Javascript Implementation of ECMAScript language

Code execution

Compiled/Transcompiled Interpreted

Type system

Static typing, strongly typed Dynamic typing, weakly typed

Advantages

Easier to debug, quicker development Little to no initial setup

Disadvantages

Moree initial setup, additional learning on top of Javascript required Some bugs may only be found in the browser, therefore, unexpected behavior

Support

Easily supports new features even on ES3 compatible browsers Specific browser version supports only a set of features

Best suited for

Large web applications Small projects, quick code debugging in the browser

Client side/ Server side

Specially used in client side Both client side and server side

File Extension

.ts, tsx .js

Syntax

Syntax defines a set of rules for writing programs. And every language specification defines its own syntax. A type script program comprises

  • Modules
  • Function
  • Variables
  • Statements and expression
  • Comments
In javascript all the statements are written within the script tsg. It also tells the browser program to start interpreting all the text between these tags as a script.

<script>

  //javascript code

</script>

 

What's your reaction?

Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0

Leave a reply

Your email address will not be published. Required fields are marked *

Next Article:

0 %