JavaScript vs TypeScript
Javascript - Client-side programming language to create interactive web pages. But it has a few disadvantages.
- As code grows, it becomes difficult to maintain and reuse code
- It doesn't support Object Orientation, strong type checking and compile-time error checks
- Can be used for small applications with the minimal code base, but not effective when application code grows.
Typescript - A modern age Javascript development language which can run on node.js or any browser which supports ECMAScript3 or above.
Features:
- Superset of Javascript
- Optionally typed scripting language. Typescript variable with no type will be inferred by Transcript Language Service(TLS) based on its value.
- Supports Object-oriented programming techniques like classes, interface, inheritance, subclasses etc..
- Rich IDE available with autocomplete and code navigation features
- Compilation - Typescript transpiler provides error checking feature. It compiles the code, generates any syntax errors and highlights them before the script is run. It highlights errors at compile time during development whereas Javascript shows errors only during runtime
- Supports javascript libraries
- Portable - Can be run on any browser, device or operating systems where javascript can run.
- DOM Manipulation
Cons -
- Takes more time to compile code
- A compilation step is required to run Typescript code in the browser
Comments
Post a Comment