diff --git a/1-js/01-getting-started/3-devtools/article.md b/1-js/01-getting-started/3-devtools/article.md index 14c9c390..442236e7 100644 --- a/1-js/01-getting-started/3-devtools/article.md +++ b/1-js/01-getting-started/3-devtools/article.md @@ -50,6 +50,12 @@ Open Preferences and go to the "Advanced" pane. There's a checkbox at the bottom Now `key:Cmd+Opt+C` can toggle the console. Also, note that the new top menu item named "Develop" has appeared. It has many commands and options. +## Multi-line input + +Usually, when we put a line of code into the console, and then press `ley:Enter`, it executes. + +To insert multiple line, press `key:Shift+Enter`. + ## Summary - Developer tools allow us to see errors, run commands, examine variables, and much more. diff --git a/1-js/02-first-steps/03-strict-mode/article.md b/1-js/02-first-steps/03-strict-mode/article.md index bd6a54f0..ff6c1527 100644 --- a/1-js/02-first-steps/03-strict-mode/article.md +++ b/1-js/02-first-steps/03-strict-mode/article.md @@ -47,6 +47,24 @@ There is no directive like `"no use strict"` that reverts the engine to old beha Once we enter strict mode, there's no return. ``` +## Browser console + +For the future, when you use a browser console to test features, please note that it doesn't `use strict` by default. + +Sometimes, when `use strict` makes a difference, you'll get incorrect results. + +Even if we press `key:Shift+Enter` to input multiple lines, and put `use strict` on top, it doesn't work. That's because of how the console executes the code internally. + +The reliable way to ensure `use strict` would be to input the code into console like this: + +``` +(function() { + 'use strict'; + + // ...your code... +})() +``` + ## Always "use strict" We have yet to cover the differences between strict mode and the "default" mode. diff --git a/1-js/11-async/08-async-iteration-generators/article.md b/1-js/11-async/08-async-iteration-generators/article.md index 743f5706..e92dc8bb 100644 --- a/1-js/11-async/08-async-iteration-generators/article.md +++ b/1-js/11-async/08-async-iteration-generators/article.md @@ -41,7 +41,7 @@ let range = { } }; -for(let value in range) { +for(let value of range) { alert(value); // 1 then 2, then 3, then 4, then 5 } ```