

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 適用於 CloudFront Functions 的 JavaScript 執行時期功能
<a name="functions-javascript-runtime-features"></a>

CloudFront Functions JavaScript 執行時期環境符合 [ECMAScript (ES) 版本 5.1](https://www.ecma-international.org/ecma-262/5.1/)，並且支援 ES 版本 6 到 12 的一些功能。

我們建議您使用 JavaScript 執行時期 2.0，以獲得最新功能。

相較於 1.0，JavaScript 執行時期 2.0 功能有下列變更：
+ 可使用緩衝區模組方法
+ 以下非標準字串原型方法無法使用：
  + `String.prototype.bytesFrom()`
  + `String.prototype.fromBytes()`
  + `String.prototype.fromUTF8()`
  + `String.prototype.toBytes()`
  + `String.prototype.toUTF8()`
+ 密碼編譯模組有以下變更：
  + `hash.digest()`：如果未提供編碼，則傳回類型變更為 `Buffer`
  + `hmac.digest()`：如果未提供編碼，則傳回類型變更為 `Buffer`
+ 如需其他新功能的詳細資訊，請參閱 [適用於 CloudFront Functions 的 JavaScript 執行時期 2.0 功能](functions-javascript-runtime-20.md)。

**Topics**
+ [JavaScript 執行時期 1.0 功能](functions-javascript-runtime-10.md)
+ [JavaScript 執行時期 2.0 功能](functions-javascript-runtime-20.md)