Last active
April 9, 2021 14:41
-
-
Save yano3nora/d90565684e5bd709aeb9db51fe35eef7 to your computer and use it in GitHub Desktop.
[js: debugger] #js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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