Home>Article>Web Front-end> What is the difference between typescript and es6

What is the difference between typescript and es6

青灯夜游
青灯夜游 Original
2023-01-11 16:24:01 2595browse

Difference: 1. Typescript is a free open source programming language developed and maintained by Microsoft; while ES6 is an ECMA internationally standardized scripting language specification. 2. TypeScript supports all primitive data types, while ES6 does not support all data types. 3. TypeScript has 3 scopes, while ES6 has 2 scopes. 4. Modules in TypeScript are divided into internal modules and external modules, while modules in ES6 are divided into import modules and export 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.

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. TypeScript is a free open source programming language developed and maintained by Microsoft. ES6 is a version of ECMAScript (ES), which is ECMA's internationally standardized scripting language specification.

2. Primitive data types

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

3. Variable scope

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

ES6 has two scopes: global scope and local scope.

4. 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!

Statement:
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