Skip to content

Instantly share code, notes, and snippets.

@yano3nora
Last active April 9, 2021 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yano3nora/d90565684e5bd709aeb9db51fe35eef7 to your computer and use it in GitHub Desktop.
Save yano3nora/d90565684e5bd709aeb9db51fe35eef7 to your computer and use it in GitHub Desktop.
[js: debugger] #js
// https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Statements/debugger
function potentiallyBuggyCode() {
// Dev Tool を開いていればここで
// break point 設定したような感じで止まってくれる
// console のスコープも同期するのでサクッと確認できる
debugger;
}
// https://stackoverflow.com/questions/28388530/why-does-chrome-debugger-think-closed-local-variable-is-undefined
//
// ↑ で触れている通り、Dev Tool の Console 上では変数 scope を固定するために
// 普段なら問題ない const, let などの定義が「定義後に即時削除」されるようになっている
// よって Console で const とか変数定義ができないことに注意
// var hoge = '' みたいに定義して代入すればいい
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment