函式作用域嚴格模式

在嚴格模式下,在塊外部無法訪問在本地塊中宣告的函式。

"use strict";
{
  f(); // 'hi'
  function f() {console.log('hi');}
}
f(); // ReferenceError: f is not defined

範圍方面,嚴格模式下的函式宣告與 let 或 const 具有相同的繫結型別。