📜  ES6 和 TypeScript 的区别

📅  最后修改于: 2021-09-11 04:10:39             🧑  作者: Mango

1. ECMAScript 6 (ES6):

ES6 也被称为 ECMAScript 2015,因为它于 2015 年发布。它的类允许开发人员使用 new运算符实例化一个对象,使用箭头函数,以防它不需要使用函数关键字来定义函数,也可以避免使用 return 关键字来获取计算机值。

2.打字稿:

TypeScript 是一种开源的面向对象的编程语言。它于 2012 年 10 月 1 日推出并推出。TypeScript 在语法上遵循 JavaScript,但为其添加了更多功能。这是JavaScript一个超集。它由 Microsoft 在 Apache 2 许可下开发和维护。它不直接在浏览器上运行,需要编译器来编译和生成 TypeScript 文件。

ES6 和 TypeScript 的区别:

SR.NO

ES6

TYPESCRIPT

1.

ECMA script 6 is the sixth edition of ECMAScript trademarked scripting language specification defined by ECMA international. TypeScript is a free and open-source pure object-oriented programming language developed and maintained by Microsoft. 

2.

It does not support all data types. It supports all primitive data types.

3.

It was introduced in 2015. It was introduced in 2012.

4.

It does not support these features. It contains features such as generics and type annotations, Inference, Enums, and Interfaces.

5.

In ES6 modules can be used by importing and exporting. Modules are of 2 types: Internal and external modules 

6.

It is comparatively more flexible in development time. It is to eradicate the development errors 

7.

It has two scopes, Global Scope, Local Scope. It has three scopes, Global Scope, Class Scope, Local Scope.

8.

The list of companies that use ES6 is Slack, StackShare, eBay, Asana, Intuit, Swat.io. The list of companies that use TypeScript is Slack, Asana, CircleCI, Intuit, Swat.io, Avocode.