Qhov txawv ntawm TypeScript thiab ES6

Cov txheej txheem:

Qhov txawv ntawm TypeScript thiab ES6
Qhov txawv ntawm TypeScript thiab ES6

Video: Qhov txawv ntawm TypeScript thiab ES6

Video: Qhov txawv ntawm TypeScript thiab ES6
Video: Korean BBQ vs Japanese BBQ: the differences in cooking style & flavor explained 2024, Kaum ib hlis
Anonim

Qhov Tseem Ceeb Qhov txawv - TypeScript vs ES6

TypeScript thiab ES6 yog ob lub thev naus laus zis ntsig txog JavaScript Muaj ntau cov nplooj ntawv web muaj nyob rau hauv Ntiaj Teb Lub Ntiaj Teb. Txhua lub koom haum tswj hwm lawv tus kheej lub vev xaib kom sib txuas lus nrog cov neeg siv khoom thiab nkag siab txog kev lag luam tiam sis. Muaj ntau yam thev naus laus zis siv rau kev txhim kho web thov. Peb lub thev naus laus zis feem ntau yog HTML, CSS thiab JavaScript. HTML muab cov qauv rau nplooj ntawv thaum CSS pab nrog kev nthuav qhia ntawm nplooj ntawv web. JavaScript yog tus neeg siv-sab scripting lus los ua kom lub vev xaib dynamic. Nws tuaj yeem siv los tsim cov animations, txheej xwm, daim ntawv validation thiab ntau ntxiv. Qee zaum JavaScript code yuav nyuaj rau tswj. Yog li ntawd, cov tsev qiv ntawv tshiab thiab hom lus sau hauv JavaScript tau qhia. Ob lub thev naus laus zis ntsig txog JavaScript yog TypeScript thiab ES6. Kab lus no tham txog qhov sib txawv ntawm TypeScript thiab ES6. TypeScript yog lub superset ntawm JavaScript, uas yog qhib qhov programming lus tsim thiab tswj los ntawm Microsoft. ES6 yog ib tug version ntawm ECMAScript (ES), uas yog ib tug scripting lus specification standardized los ntawm ECMA thoob ntiaj teb. Qhov ntawd yog qhov sib txawv tseem ceeb ntawm TypeScript thiab ES6. TypeScript muaj qhov tshwj xeeb ntawm ES5 thiab ES6.

TypeScript yog dab tsi?

TypeScript yog hom lus raws li JavaScript. Nws tau tsim los ntawm Microsoft. Nws muaj tag nrho cov yam ntxwv ntawm JavaScript. Typescript yog ib hom lus xaiv rau JavaScript. Nws siv TypeScript compiler los hloov cov ntaub ntawv TypeScript (ts) rau hauv JavaScript (js). TypeScript generated JavaScript tuaj yeem rov siv tau tag nrho cov txheej txheem JavaScript thiab cov tsev qiv ntawv uas twb muaj lawm. TypeScript compiler muab kev kuaj xyuas yuam kev. Yog li ntawd, yog hais tias tus code muaj ib qho kev ua yuam kev, nws yuav tsim ib tug compilation yuam kev. Cov txheej txheem no yuav pab nrhiav qhov yuam kev ua ntej khiav cov ntawv. TypeScript kuj muaj TypeScript Language Service. Nws ua hauj lwm raws li ib txheej ntxiv nyob ib ncig ntawm lub core compiler. Nws pab kho cov haujlwm xws li kev ua tiav cov lus qhia, code formatting thiab outlining.

TypeScript txhawb ntau hom ntaub ntawv. Ib txhia ntawm lawv yog String, Number, Boolean, Array, Enum, Tuple, generics. Ib qho txiaj ntsig tseem ceeb ntawm TypeScript yog tias nws pab tsim cov khoom siv hauv chav kawm. Feem ntau cov lus programming xws li Java, C ++ txhawb nqa Object Oriented programming. Raws li TypeScript yog nyob rau hauv chav kawm ntawv, yog li nws muaj peev xwm txhawb OOP cov ntsiab lus xws li qub txeeg qub teg, interfaces, thiab lwm yam. Zuag qhia tag nrho, Typescript yog tib yam li JavaScript tab sis nrog cov yam ntxwv ntxiv. Lub ntsiab kom zoo dua ntawm TypeScript yog tias nws pab cov programmers sau cov lej zoo dua.

ES6 yog dab tsi?

ECMAScript (ES) yog cov cim kev lag luam luam ntawv cov lus qhia tus qauv tsim los ntawm ECMA thoob ntiaj teb. Nws tau tsim los ua qauv JavaScript. Nws muaj ntau yam kev siv. Qhov kev siv nrov tshaj plaws ntawm ECMAScript yog JavaScript. Cov programmers siv ECMAScript feem ntau rau cov neeg siv-sab sau ntawv ntawm World Wide Web. (WWW). Niaj hnub no, server-sab programming yog ua tiav siv Node.js, uas yog tus ntoo khaub lig-platform JavaScript runtime ib puag ncig. Muaj ntau ntau yam ntawm ECMA 262.

Qhov txawv ntawm TypeScript thiab ES6
Qhov txawv ntawm TypeScript thiab ES6

The 6th ib tsab ntawm ECMAScript yog ECMAScript6 lossis ES6. Nws tseem muaj npe hu ua ECMAScript 2015. Nws pab sau cov kev pab cuam rau cov ntawv thov nyuaj. Nws txhawb cov chav kawm rau cov khoom taw qhia. Nws muaj cov modules. Ib qho module yog ib txheej ntawm JavaScript code sau rau hauv ib cov ntaub ntawv. Ua ntej siv ib qho kev sib txawv los yog txoj hauv kev hauv module, nws yog ib qho tsim nyog yuav tau import lawv. Feem ntau ES6 browsers yog Chrome thiab Firefox. ES6 raws li code tau hloov mus rau ES5 siv lub transpiler. ES5 tau txais kev txhawb nqa los ntawm ntau lub browsers. TypeScript yog ib qho transpiler. Grunt, Gulp thiab Babel yog ib co lwm yam transpilers los sau cov modules. Yog li ntawd, ES6 tau txais kev txhawb los ntawm TypeScript.

Dab tsi yog qhov zoo sib xws ntawm TypeScript thiab ES6?

  • Ob qho tib si TypeScript thiab ES6 cuam tshuam rau kev txhim kho lub vev xaib.
  • TypeScript hom lus zoo li Modules thiab kev taw qhia hauv chav kawm yog ua raws li ECMAScript 6 (ES6) specification.

Qhov txawv ntawm Typescript thiab ES6 yog dab tsi?

TypeScript vs ES6

TypeScript yog lub superset ntawm JavaScript uas yog qhib qhov programming lus tsim thiab tswj hwm los ntawm Microsoft. EC6 yog ib qho version ntawm ECMAScript (ES) uas yog cov lus sau ntawv tus qauv tsim los ntawm ECMA thoob ntiaj teb.
nta
TypeScript muaj cov yam ntxwv xws li generics thiab hom annotations, Interfaces, Enums. Cov yam ntxwv saum toj no tsis txaus siab los ntawm ES6.

Summary – TypeScript vs ES6

TypeScript thiab ES6 yog ob lub thev naus laus zis raws li JavaScript. TypeScript yog lub superset ntawm JavaScript uas yog qhib qhov programming lus tsim thiab tswj los ntawm Microsoft. ES6 yog ib tug version ntawm ECMAScript (ES) uas yog ib tug scripting lus specification standardized los ntawm ECMA thoob ntiaj teb. Qhov ntawd yog qhov txawv ntawm TypeScript thiab ES6. TypeScript muaj cov lus qhia tshwj xeeb ntawm ES5 thiab ES6. TypeScript cov yam ntxwv zoo li Modules thiab kev taw qhia hauv chav kawm yog nyob rau hauv ES6 qhov tshwj xeeb thaum cov yam ntxwv zoo li generics thiab hom annotations tsis suav nrog hauv ES6 specifications.

Pom zoo: