TypeScript and JavaScript are two of the more popular scripting languages in current project development. We already know that TypeScript is a superset of JavaScript.
TypeScript is a free and open source programming language developed by Microsoft. It is a superset of JavaScript and essentially adds optional static typing and class-based object-oriented programming to the language. Anders Helsberg, chief architect of C#, has worked on TypeScript development. In October 2012, Microsoft released the first public version of TypeScript. On June 19, 2013, after a preview version, Microsoft officially released the official version of TypeScript 0.9, taking a big step towards the future TypeScript 1.0 version.
JavaScript is a literal scripting language, a dynamically typed, weakly typed, prototype-based language with built-in support for types. Its interpreter is called the JavaScript engine, which is part of the browser and is widely used in client-side scripting languages. It was first used on HTML (an application under Standard Universal Markup Language) web pages to add dynamic functions to HTML web pages. .
The main differences between JavaScript and TypeScript:
1. TypeScript can use all codes and coding concepts in JavaScript. TypeScript is to make JavaScript development easier And created. For example, TypeScript uses concepts such as types and interfaces to describe the data being used, which enables developers to quickly detect errors and debug applications. The object model is extended.
3. JavaScript code can work with TypeScript without any modification, and a compiler can be used to convert TypeScript code into JavaScript.
4. TypeScript provides compile-time static type checking through type annotations.
5. Data in TypeScript requires clear types, but JavaScript does not.
6. TypeScript provides default parameter values for functions.
7. TypeScript introduces the concept of "class" that is not found in JavaScript.
8. TypeScript introduces the concept of modules, which can encapsulate declarations, data, functions and classes in modules.
Related learning recommendations:js video tutorial
The above is the detailed content of The difference between TypeScript and JavaScript. For more information, please follow other related articles on the PHP Chinese website!