Skip to content

Commit 2b7aa48

Browse files
authored
Update part1d.md
1 parent e63eb89 commit 2b7aa48

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/content/1/en/part1d.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ If and when your code fails to compile and your browser lights up like a Christm
478478
![screenshot of code](../../images/1/6x.png)
479479

480480
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+
482482
Old-school, print-based debugging is always a good idea. If the component
483483

484484
```js
@@ -505,25 +505,25 @@ const Button = (props) => {
505505

506506
This will immediately reveal if, for instance, one of the attributes has been misspelled when using the component.
507507

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:
509509

510510
```js
511511
console.log('props value is ' + props)
512512
```
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:
515515

516516
```js
517-
console.log('props value is', props)
517+
props value is [object Object]
518518
```
519519

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:
521521

522522
```js
523-
props value is [object Object]
523+
console.log('props value is', props)
524524
```
525525

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.
527527

528528
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.
529529

0 commit comments

Comments
 (0)