Skip to content

Commit 277de1d

Browse files
992manavsumn2u
authored andcommitted
Fix markdown syntax in Debugging chapter #308
1 parent 9336912 commit 277de1d

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

en/miscellaneous/debugging.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ chapter: 19
33
pageNumber: 122
44
description: In programming, errors can occur while writing code. It could be due to syntactical or logical errors. The process of finding errors can be time-consuming and tricky and is called code debugging.
55
---
6+
67
# Debugging
78

89
In programming, errors can occur while writing code. It could be due to syntactical or logical errors. **Code debugging** is the process of identifying, isolating, and fixing errors, which can be time-consuming and tricky.
@@ -11,18 +12,19 @@ Fortunately, most modern browsers come with built-in debuggers. These debuggers
1112

1213
## The console.log() Technique
1314

14-
One of the simplest and most widely used debugging methods is using the `console.log()` function. It helps you track the flow of your code and inspect the values of variables at specific points in execution.
15+
One of the simplest and most widely used debugging methods is using the `console.log()` function. It helps you track the flow of your code and inspect the values of variables at specific points in execution.
1516

1617
```javascript
1718
function calculateTotal(price, taxRate) {
1819
const tax = price * taxRate;
19-
console.log('Tax calculated:', tax); // Output for inspection
20+
console.log("Tax calculated:", tax); // Output for inspection
2021
const total = price + tax;
2122
return total;
2223
}
2324

2425
calculateTotal(100, 0.2);
2526
```
27+
2628
Use `console.log()` to:
2729

2830
- Check if a function is being called.
@@ -42,6 +44,7 @@ A breakpoint is a spot in your code where execution will pause, allowing you to
4244
Modern browsers offer developer tools with debugging capabilities.
4345

4446
### How to Set Breakpoints
47+
4548
1. Open the Sources panel in DevTools.
4649
2. Navigate to your script file.
4750
3. Click on the line number where you want execution to pause.
@@ -52,9 +55,10 @@ Once paused, you can:
5255
- **Step into** – dive into a function call.
5356
- **Step out** – exit the current function.
5457
- **Resume** – continue execution until the next breakpoint.
55-
Breakpoints are non-intrusive and can be added/removed without changing your code.
58+
Breakpoints are non-intrusive and can be added/removed without changing your code.
5659

5760
## Browser Developer Tools
61+
5862
Modern browsers come equipped with powerful developer tools that aid in debugging JavaScript, inspecting HTML and CSS, and monitoring network requests. Here's a brief overview of some essential tools:
5963

6064
**Chrome DevTools:** Google Chrome's developer tools offer a wide range of features for debugging web applications.
@@ -71,6 +75,7 @@ Browsers provide a set of developer tools that allow you to inspect HTML, CSS, a
7175
We can access them by right-clicking on a web page and selecting "Inspect" or by pressing `F12` or `Ctrl+Shift+I`/ `Cmd + Option + I` (Mac).
7276

7377
### Key Panels in Developer Tools
78+
7479
- **Console:** Displays logs, errors, and allows executing JS in real time.
7580
- **Elements / Inspector:** Lets you browse and edit the HTML and CSS.
7681
- **Sources:** Where you debug JavaScript using breakpoints.
@@ -83,7 +88,7 @@ We can insert the debugger statement in the code to create breakpoints programma
8388

8489
In the DevTools, you can **watch** variables or expressions. This is helpful when debugging complex logic or tracking a variable over time.
8590

86-
- Use the **Watch** panel to track expressions like user.name or cart.length.
91+
- Use the **Watch** panel to track expressions like `user.name` or `cart.length`.
8792
- View **Local**, **Closure**, and **Global** scopes to inspect available variables.
8893

8994
### Stack Trace and Call Stack
@@ -92,7 +97,7 @@ When paused at a breakpoint (or after an error), you can inspect the Call Stack
9297

9398
- It shows the series of function calls that led to the current point.
9499
- Clicking on a frame lets you inspect variables in that context.
95-
Understanding the call stack is vital for fixing unexpected behaviors caused by incorrect function flows.
100+
Understanding the call stack is vital for fixing unexpected behaviors caused by incorrect function flows.
96101

97102
## Common Debugging Strategies
98103

@@ -102,4 +107,3 @@ Understanding the call stack is vital for fixing unexpected behaviors caused by
102107
- **Search for error messages**: JavaScript errors often contain helpful information.
103108
- **Check browser compatibility**: Not all browsers behave identically.
104109
- **Use linters**: Tools like ESLint can catch many common bugs before you run your code.
105-

es/miscellaneous/debugging.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ chapter: 19
33
pageNumber: 152
44
description: En programación, pueden ocurrir errores al escribir código. Podría deberse a errores sintácticos o lógicos. El proceso de encontrar errores puede llevar mucho tiempo y ser complicado y se denomina depuración de código.
55
---
6+
67
# Depuración
78

89
En programación, es común que ocurran errores mientras se escribe el código. Estos pueden ser errores sintácticos o lógicos. La depuración de código es el proceso de identificar, aislar y corregir estos errores, lo cual puede ser un proceso complicado y que consume tiempo.
@@ -16,7 +17,7 @@ Una de las formas más simples y populares de depurar código es utilizando la f
1617
```javascript
1718
function calcularTotal(precio, porcentajeImpuesto) {
1819
const impuesto = precio * porcentajeImpuesto;
19-
console.log('Impuesto calculado:', impuesto); // Salida para inspección
20+
console.log("Impuesto calculado:", impuesto); // Salida para inspección
2021
const total = precio + impuesto;
2122
return total;
2223
}
@@ -44,6 +45,7 @@ Un punto de interrupción es una línea en tu código donde la ejecución se det
4445
Los navegadores modernos ofrecen herramientas para desarrolladores con capacidades de depuración.
4546

4647
### Cómo establecer puntos de interrupción
48+
4749
1. Abre el panel Sources en las DevTools.
4850
2. Navega hasta tu archivo de script.
4951
3. Haz clic en el número de línea donde quieres que la ejecución se detenga.
@@ -70,10 +72,12 @@ Los navegadores modernos vienen equipados con potentes herramientas de desarroll
7072
**Safari Web Inspector:** Web Inspector de Safari es un sólido conjunto de herramientas para depurar y crear perfiles de aplicaciones web.
7173

7274
### Acceso a las herramientas del navegador
75+
7376
Los navegadores ofrecen herramientas para inspeccionar HTML, CSS y JavaScript. Podemos acceder a ellas:
7477
Haciendo clic derecho sobre la página y seleccionando "Inspeccionar" o presionando `F12` o `Ctrl + Shift + I` / `Cmd + Option + I` (Mac)
7578

7679
### Paneles clave en las herramientas del navegador
80+
7781
- **Console (Consola)**: Muestra registros, errores y permite ejecutar JavaScript en tiempo real.
7882
- **Elements / Inspector**: Permite examinar y modificar el HTML y CSS del documento.
7983
- **Sources**: Lugar donde se depura JavaScript usando puntos de interrupción.
@@ -83,17 +87,19 @@ Haciendo clic derecho sobre la página y seleccionando "Inspeccionar" o presiona
8387
Podemos insertar la instrucción debugger directamente en el código para crear un punto de interrupción de forma programada. Cuando el código encuentra debugger, se pausará la ejecución y se abrirán las herramientas de desarrollo del navegador (si están abiertas).
8488

8589
### Expresiones de vigilancia y alcance (Watch & Scope)
90+
8691
En las DevTools puedes vigilar variables o expresiones. Esto es útil cuando depuras lógica compleja o haces seguimiento de una variable a lo largo del tiempo.
8792

88-
- Usa el panel Watch para seguir expresiones como usuario.nombre o carrito.length.
93+
- Usa el panel Watch para seguir expresiones como `usuario.nombre` o `carrito.length`.
8994
- Examina los alcances Local, Closure y Global para inspeccionar las variables disponibles en cada contexto.
9095

9196
### Rastreo de pila y Call Stack
97+
9298
Cuando el código se detiene en un punto de interrupción (o tras un error), puedes inspeccionar el panel de Call Stack:
9399

94100
- Muestra la secuencia de funciones llamadas que llevaron hasta el punto actual.
95101
- Al hacer clic en un marco (frame), puedes examinar variables en ese contexto.
96-
Entender la pila de llamadas es esencial para corregir comportamientos inesperados producidos por un flujo de ejecución incorrecto.
102+
Entender la pila de llamadas es esencial para corregir comportamientos inesperados producidos por un flujo de ejecución incorrecto.
97103

98104
## Estrategias comunes de depuración
99105

0 commit comments

Comments
 (0)