minor fixes
This commit is contained in:
parent
2af74029e2
commit
ce8e68f21c
5 changed files with 15 additions and 12 deletions
|
@ -29,10 +29,15 @@ The exact look of developer tools depends on your version of Chrome. It changes
|
|||
- Here we can see the red-colored error message. In this case, the script contains an unknown "lalala" command.
|
||||
- On the right, there is a clickable link to the source `bug.html:12` with the line number where the error has occurred.
|
||||
|
||||
Below the error message, there is a blue `>` symbol. It marks a "command line" where we can type JavaScript commands. Press `key:Enter` to run them (`key:Shift+Enter` to input multi-line commands).
|
||||
Below the error message, there is a blue `>` symbol. It marks a "command line" where we can type JavaScript commands. Press `key:Enter` to run them.
|
||||
|
||||
Now we can see errors, and that's enough for a start. We'll come back to developer tools later and cover debugging more in-depth in the chapter <info:debugging-chrome>.
|
||||
|
||||
```smart header="Multi-line input"
|
||||
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.
|
||||
|
||||
To insert multiple lines, press `key:Shift+Enter`. This way one can enter long fragments of JavaScript code.
|
||||
```
|
||||
|
||||
## Firefox, Edge, and others
|
||||
|
||||
|
@ -50,12 +55,6 @@ 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.
|
||||
|
||||
```smart header="Multi-line input"
|
||||
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.
|
||||
|
||||
To insert multiple lines, press `key:Shift+Enter`. This way one can enter long fragments of JavaScript code.
|
||||
```
|
||||
|
||||
## Summary
|
||||
|
||||
- Developer tools allow us to see errors, run commands, examine variables, and much more.
|
||||
|
|
|
@ -62,6 +62,8 @@ function formatDate(date) {
|
|||
year = year.toString().slice(-2);
|
||||
month = month < 10 ? '0' + month : month;
|
||||
dayOfMonth = dayOfMonth < 10 ? '0' + dayOfMonth : dayOfMonth;
|
||||
hour = hour < 10 ? '0' + hour : hour;
|
||||
minutes = minutes < 10 ? '0' + minutes : minutes;
|
||||
|
||||
if (diffSec < 1) {
|
||||
return 'right now';
|
||||
|
|
|
@ -149,8 +149,8 @@ let user = { name: "John" };
|
|||
let admin = { name: "Admin" };
|
||||
|
||||
// use call to pass different objects as "this"
|
||||
sayHi.call( user ); // this = John
|
||||
sayHi.call( admin ); // this = Admin
|
||||
sayHi.call( user ); // John
|
||||
sayHi.call( admin ); // Admin
|
||||
```
|
||||
|
||||
And here we use `call` to call `say` with the given context and phrase:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue