On the understanding of Ecma5script, ECMASCRIPT6 and Typescript

Source: Internet
Author: User

What is ECMAScript and what is ECMA?

ECMA International (ECMA International) is an international membership system for the information and Telecommunications Standards Organization. Before 1994, the European Association of Computer Manufacturers (European Computer Manufacturers Association). Because of the internationalization of computers, the organization's standards involve many other countries, so the organization decided to change its name to indicate its internationality. The present name does not belong to the acronym.

ECMAScript is a script programming language that is standardized by the ECMA International (formerly the European Association of Computer manufacturers, the English name is European Computer Manufacturers Association) through ECMA-262. This language is widely used on the World Wide Web, and it is often referred to as JavaScript or JScript, but in fact the latter two are implementations and extensions of the ECMA-262 standard.

What exactly is the relationship between ECMAScript and JavaScript?

Many beginners will be confused, simply put, ECMAScript is the international standard of JavaScript language, JavaScript is the implementation of ECMAScript .

What is ECMAScript5 and what is ECMASCRIPT6?

Some people always think that ECMAScript5 is the so-called ECMAScript2015 (because there is a 5?). In fact, it was wrong, as early as the December 2009 ECMA Company released the ECMASCRIPT5.

What we call ECMAScript6, released in June 2015, is the next-generation standard for JavaScript, and officials say Ecmascript2015,mozilla will launch JavaScript 2.0 on the basis of this standard.

ECMASCRIPT6 is a major improvement following ECMAScript5, with the language specification expanded from 245 pages in the ES5.1 era to 600 pages. The goal of ECMASCRIPT6 is to make the JavaScript language useful for writing large, complex applications that become enterprise-level development languages. ECMAScript6 adds many of the necessary features, such as modules and classes, as well as practical features such as maps, sets, Promises, generators (generators), and so on. Although ECMASCRIPT6 has done a lot of updates, it is still completely backwards compatible with previous versions, and the standardization Committee decided to avoid "web experience fragmentation" caused by incompatible version languages. As a result, all old code works and the transition is smoother, but the problem is that developers complain that the old problems persist for years.

What's annoying is that there is currently no JavaScript proxy that fully supports ES6 (whether it's a browser or server environment), so we really use ECMASCRIPT6 developers to translate ECMASCRIPT6 code into ECMASCRIPT5 code.

What is Typescript?

Typescript is a free and open source programming language developed by Microsoft. Note: The official explanation typescript is a programming language, please remember.

It is a superset of JavaScript and essentially adds optional static types and class-based object-oriented programming to the language. Typescript extends the syntax of JavaScript, so any existing JavaScript program can work without change in typescript. Typescript is designed for the development of large applications, and it generates JavaScript at compile time to ensure compatibility. Where it progresses in comparison to JavaScript includes adding comments, letting the compiler understand the supported objects and functions, and the compiler removing annotations without increasing overhead. While JavaScript is a scripting language, not designed to develop large Web applications,JavaScript does not provide the concepts of classes and modules, and the typescript extension implements these features.

The biggest feature of TypeScript is the type, which is called TypeScript. Typed typescript are easier to maintain than weakly typed JavaScript.

Here a little bit, some people think that Typescript has an advantage is to go through the TSC compiled, he can know some errors in the compilation period, this is the advantage? I was speechless, whether using TSC for monitoring compilation, manually triggering command compilation, or compiling by writing gulp scripts, the process is unbearable (because I have used the Gulp scripts provided by TSC and Ionic2), for example, if you are writing a class, After writing to see the effect immediately, this time you find your CLI is desperately compiling, good time in about 3 seconds you can see the page effect, imagine, if the project is greater, how long do you think the project to compile?

Typescript to go through the TSC compiler is not its advantage, if let Microsoft choose it would rather all the hosting environment can run it directly, compile can check the error is nothing but syntax and dependencies and other errors, does not mean that the real run time without errors, I have many times in the compiler error-free, There are a lot of errors during the run, depending on how you use the framework and the implementation of your business logic, as you would with the servlet write service, which would certainly mean that the runtime will not be abnormal? In fact, there is no comparability, in fact, to go through the TSC compilation is precisely a disadvantage of typesciprt, in the development process instead of bringing us a lot of inconvenience.

The difference between typescript and ECMAScript6?

First, we all expect the current hosting environment to be able to run ECMASCRIPT6 directly, and I haven't seen anyone say that expect the browser to run Typescript directly, because EXMASCRIPT6 is a standard, and typescript realized the characteristics of ECMASCRIPT6, and on this has to expand, that is to say typescript some features are not ECMASCRIPT6 specifications, which said two is a thing is actually wrong, It can only be explained that some of them are identical and do not represent a thing. Because currently our hosting environment is not able to run typescript and ECMASCRIPT6 directly, both require compiler compilation, and the target language is JavaScript, in our When writing typescript you can use JavaScript, in my opinion the compiler big deal does not compile that piece of JavaScript code, right! So we write typescript in fact can write ECMASCRIPT6, the reason is very simple you will use TSC to compile, then you imagine you write typescript is to use ECMA6 standard to compile, OK? Now do you think they're a thing?

If you don't understand, I can only get into the code, for example, we now define a class:

Using ECMASCRIPT6:

So we use typescript to write it:

Even for convenience, we can write

Well, it's a little late today, and I'll have to do some laundry today, and here we need to see the documentation for the small partners, because nothing is more authoritative than the document. Here is the relevant website, we can look at:

ecma6:http://www.ecma-international.org/ecma-262/6.0/

typescript:https://www.typescriptlang.org/

Please continue to follow my series of articles, Ionic2 Development Guide and ANGULAR2 development of the actual combat.

On the understanding of Ecma5script, ECMASCRIPT6 and Typescript

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.