What is the difference between typescript and es6?

青灯夜游
Release: 2022-03-23 14:31:35
Original
3995 people have browsed it

Difference: 1. TypeScript supports all primitive data types, while ES6 does not support all data types; 2. TypeScript has 3 scopes, while ES6 has 2 scopes; 3. Modules in TypeScript are divided into internal Modules and external modules, and modules in ES6 are divided into imported modules and exported modules.

What is the difference between typescript and es6?

The operating environment of this tutorial: Windows 7 system, ECMAScript version 6, Dell G3 computer.

TypeScript

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.

TypeScript extends the syntax of JavaScript, so any existing JavaScript program can work under TypeScript unchanged. TypeScript is designed for large-scale application development, and it generates JavaScript when compiled to ensure compatibility.

TypeScript supports header files that add type information to existing JavaScript libraries, extending its benefits to popular libraries such as jQuery, MongoDB, Node.js, and D3.js.

History of TypeScript

Anders Hejlsberg developed TypeScript. It was first launched to the public on October 1, 2012. After two years of development within Microsoft, a new version of TypeScript 0.9 was released in 2013. TypeScript 3.4.5 was released on April 24, 2019.

ES6

ECMAScript (ES) is a scripting language specification standardized internationally by ECMA. It was created to standardize JavaScript. The ES scripting language contains many implementations, the most popular of which is JavaScript. Developers primarily use ECMAScript for client-side scripting on the World Wide Web (WWW).

The sixth edition of the ECMAScript standard is ECMAScript6 or ES6, which was later renamed ECMAScript 2015. It is a major enhancement to the JavaScript language that allows us to write programs for complex applications. It adds many features designed to simplify large-scale software development. The most common ES6 web browsers are Chrome and Firefox. The transpiler converts ES6-based code to ES5 which supports many browsers. TypeScript is a transpiler. Grunt, Gulp, and Babel are some other transpilers for compiling modules. Therefore, TypeScript supports ES6.

History

JavaScript was introduced in May 1995 by Brendan Eich. It was originally called Mocha, chosen by Netscape founder Marc Andreessen, and later renamed LiveScript. Meanwhile, Sun Microsystems owns the JavaScript trademark. In December 1995, Netscape obtained a trademark license and renamed it JavaScript.

Between 1996 and 1997, Netscape brought JavaScript to the ECMA standards organization to maintain the specification of the language. In June 1997, ECMA Technical Committee 39 (TC39) was created to continue developing the language, culminating in the publication of ECMA-262 Ed.1.

The first standard version of JavaScript was ECMAScript 1, released in June 1997. A year later, ECMAScript 2 was released, containing only minor changes to keep JavaScript a parallel ISO standard. In December 1999, ECMAScript 3 was released, introducing many popular features of JavaScript. In December 2009, ECMAScript or ES6 was released and subsequently renamed ECMAScript 2015.

The difference between TypeScript and ES6

1. Primitive data types

TypeScript supports all primitive data types, while ES6 does not support all data types.

2. Variable scope

TypeScript has three scopes: global scope, class scope, and local scope.

ES6 has two scopes: global scope and local scope.

3. Module

In TypeScript, there are two types of modules: internal and external modules

In ES6, modules are divided into import modules and export modules.

【Related recommendations: javascript video tutorial, web front-end

The above is the detailed content of What is the difference between typescript and es6?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!