Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

ทำไมต้องใช้ Babel JS?

Babel เป็น toolchain ที่ใช้แปลง ECMAScript 2015+ code เป็น backward-compatible version ของ JavaScript ในเบราว์เซอร์เก่าและปัจจุบัน หรือ environments อื่นๆ Babel plugins ให้ใช้ syntax ใหม่ได้เลย ไม่ต้องรอ browser support

เหตุผลหลักในการใช้ Babel JS:

  • Syntax transformation (Latest JS syntax → backward-compatible syntax)

  • Polyfill features ที่ขาดใน target environment (ผ่าน @babel/polyfill)

  • Source code transformations (code mods)