# Polyfills

## Babel

當使用語言的新特性，瀏覽器不一樣支援，這時候要使用轉譯器將程式碼轉為較老舊瀏覽器支援的寫法。Babel 包含2 個部分；

1. 轉譯程式，將重新改寫程式碼轉為老舊支援的寫法，webpack 就提供了這樣自動轉譯的功能，對於工程師來說沒有時間的損失。
2. polyfill 新的特性包含內建函式跟語法結構，轉譯器可以轉譯成就的語法結構，但新的函式需要額外加上去。

* &#x20;[babel polyfill](https://babeljs.io/docs/usage/polyfill/) 支援很多函式，但吃資源
* &#x20;[polyfill.io](http://polyfill.io/) 可以視需求加需要的功能

&#x20;[Chrome Canary](https://www.google.com/chrome/browser/canary.html) 可以使用所有新特性。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mistborn.gitbook.io/til-coding/javascript/polyfills.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
