スコープでバグになるサンプル

onclick属性だとuse strictでスコープが下記のようになっていると動作しない。

<button onclick="hello()">hello</button>
"use strict";
{
  function hello() {
    alert('hello')
  }
}

元記事を表示する