You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/1/en/part1d.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -478,7 +478,7 @@ If and when your code fails to compile and your browser lights up like a Christm
478
478

479
479
480
480
don't write more code but rather find and fix the problem **immediately**. There has yet to be a moment in the history of coding where code that fails to compile would miraculously start working after writing large amounts of additional code. I highly doubt that such an event will transpire during this course either.
481
-
481
+
482
482
Old-school, print-based debugging is always a good idea. If the component
483
483
484
484
```js
@@ -505,25 +505,25 @@ const Button = (props) => {
505
505
506
506
This will immediately reveal if, for instance, one of the attributes has been misspelled when using the component.
507
507
508
-
**NB** When you use _console.log_ for debugging, don't combine _objects_ in a Java-like fashion by using the plus operator. Instead of writing:
508
+
**NB** When you use _console.log_ for debugging, don't combine _objects_ in a Java-like fashion by using the plus operator:
509
509
510
510
```js
511
511
console.log('props value is '+ props)
512
512
```
513
-
514
-
Separate the things you want to log to the console with a comma:
513
+
514
+
If you do that, you will end up with a rather uninformative log message:
515
515
516
516
```js
517
-
console.log('props value is', props)
517
+
props value is [object Object]
518
518
```
519
519
520
-
If you use the Java-like way of concatenating a string with an object, you will end up with a rather uninformative log message:
520
+
Instead, separate the things you want to log to the console with a comma:
521
521
522
522
```js
523
-
props value is [object Object]
523
+
console.log('props value is', props)
524
524
```
525
525
526
-
Whereas the items separated by a comma will all be available in the browser console for further inspection.
526
+
In this way, the separated items will all be available in the browser console for further inspection.
527
527
528
528
Logging output to the console is by no means the only way of debugging our applications. You can pause the execution of your application code in the Chrome developer console's <i>debugger</i>, by writing the command [debugger](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger) anywhere in your code.
0 commit comments