Skip to content

Commit 5457a9c

Browse files
authored
Merge pull request #34 from AnggieAlava/bug/1546
Add a small sample code in the readme
2 parents 9127fd1 + b01a796 commit 5457a9c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

exercises/07-count-on-click/README.es.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Si tienes **variables globales**, puedes cambiar su valor durante el tiempo de ejecución usando los handlers de eventos. Por ejemplo, este código incrementa el valor de la variable `counter` cada vez que el usuario hace clic en el botón **Increase**.
44

5+
```js
6+
window.increaseCounter = function increaseCounter() {
7+
counter++;
8+
}
9+
```
10+
511
## 📝 Instrucciones:
612

713
1. Crea un botón que disminuya con una función handler de evento. La función debería disminuir la variable `counter` y actualizar el número en pantalla.

exercises/07-count-on-click/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
If you have global variables, you can change their value during runtime using event handlers. For example, this code is increasing the value of the `counter` variable every time the user clicks on the **Increase** button.
44

5+
```js
6+
window.increaseCounter = function increaseCounter() {
7+
counter++;
8+
}
9+
```
10+
511
## 📝 Instructions:
612

713
1. Create a decrease button with an event handler function. The function should decrease the `counter` variable and update the number on screen.

0 commit comments

Comments
 (0)