Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Functions#230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vplentinax merged 31 commits intojavascript-tutorial:masterfromvplentinax:Giorgiosaud-function-basics
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
31 commits
Select commitHold shift + click to select a range
76be9f6
Giorgiosaud-PR95-correccion
vplentinaxJun 5, 2020
f95071e
Update 1-js/02-first-steps/15-function-basics/1-if-else-required/task.md
EzequielCasteJun 15, 2020
09ffe2a
Update 1-js/02-first-steps/15-function-basics/2-rewrite-function-ques…
EzequielCasteJun 15, 2020
70b78b8
Update 1-js/02-first-steps/15-function-basics/article.md
EzequielCasteJun 15, 2020
bdfa86a
Update 1-js/02-first-steps/15-function-basics/article.md
EzequielCasteJun 15, 2020
f92cde2
Update 1-js/02-first-steps/15-function-basics/article.md
EzequielCasteJun 15, 2020
71c8b5f
Update 1-js/02-first-steps/15-function-basics/article.md
EzequielCasteJun 15, 2020
37463e9
Update 1-js/02-first-steps/15-function-basics/article.md
EzequielCasteJun 15, 2020
70e926b
Update 1-js/02-first-steps/15-function-basics/article.md
EzequielCasteJun 15, 2020
03bc402
Update 1-js/02-first-steps/15-function-basics/article.md
EzequielCasteJun 15, 2020
d5c47ee
Update 1-js/02-first-steps/15-function-basics/article.md
EzequielCasteJun 15, 2020
f6655c0
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJun 16, 2020
023b516
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJun 16, 2020
25dfc7f
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJun 16, 2020
f4e78a7
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJun 16, 2020
d944b06
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJun 16, 2020
6e08312
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJun 16, 2020
05538ed
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
bd731dc
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
7312c8f
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
06a0d8f
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
3dde6f3
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
22dec62
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
7776d6e
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
fb1b96f
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
86af996
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
5b73d94
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
b889666
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
ca8c18d
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
9f1b86d
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
bd45ddd
Update 1-js/02-first-steps/15-function-basics/article.md
vplentinaxJul 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
No difference.
Ninguna diferencia.
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,11 +2,11 @@ importance: 4

---

#Is "else"required?
#¿Es "else"requerido?

The following function returns `true`if the parameter `age`is greater than `18`.
La siguiente función devuelve `true`si el parámetro `age`es mayor a `18`.

Otherwise it asks for a confirmation and returns its result:
De lo contrario, solicita una confirmación y devuelve su resultado:

```js
function checkAge(age) {
Expand All@@ -15,13 +15,13 @@ function checkAge(age) {
*!*
} else {
// ...
return confirm('Did parents allow you?');
return confirm('¿Tus padres te permitieron?');
}
*/!*
}
```

Will the function work differently if`else` is removed?
¿Funcionará la función de manera diferente si se borra`else`?

```js
function checkAge(age) {
Expand All@@ -30,9 +30,9 @@ function checkAge(age) {
}
*!*
// ...
return confirm('Did parents allow you?');
return confirm('¿Tus padres te permitieron?');
*/!*
}
```

Is there any difference in the behavior of these two variants?
¿Hay alguna diferencia en el comportamiento de estas dos variantes?
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,16 +2,16 @@ Using a question mark operator `'?'`:

```js
function checkAge(age) {
return (age > 18) ? true : confirm('Did parents allow you?');
return (age > 18) ? true : confirm('¿Tús padres te lo permitieron?');
}
```

Using OR `||` (the shortest variant):
Usando Ó `||` (la variante más corta):

```js
function checkAge(age) {
return (age > 18) || confirm('Did parents allow you?');
return (age > 18) || confirm('¿Tús padres te lo permitieron?');
}
```

Note that the parentheses around`age > 18`are not required here. They exist for better readabilty.
Tenga en cuenta que los paréntesis alrededor de`age > 18`no son requeridos aca. Existen para una mejor legibilidad.
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,25 +2,25 @@ importance: 4

---

#Rewrite the function using '?'or '||'
#Reescriba la función utilizando '?'o '||'

The following function returns `true`if the parameter `age`is greater than `18`.
La siguiente función devuelve `true`si el parametro `age`es mayor que `18`.

Otherwise it asks for a confirmation and returns its result.
De lo contrario, solicita una confirmación y devuelve su resultado.

```js
function checkAge(age) {
if (age > 18) {
return true;
} else {
return confirm('Do you have your parents permission to access this page?');
return confirm('¿Tienes permiso de tus padres para acceder a esta página?');
}
}
```

Rewrite it, to perform the same, but without `if`,in a single line.
Reescríbalo, para realizar lo mismo, pero sin `if`,en una sola linea.

Make two variants of `checkAge`:
Haz dos variantes de `checkAge`:

1.Using a question mark operator `?`
2.Using OR `||`
1.Usando un operador de signo de interrogación `?`
2.Usando Ó `||`
4 changes: 2 additions & 2 deletions1-js/02-first-steps/15-function-basics/3-min/solution.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,12 +10,12 @@ function min(a, b) {
}
```

A solution with a question mark operator `'?'`:
Una solución con un operador de signo de interrogación `'?'`:

```js
function min(a, b) {
return a < b ? a : b;
}
```

P.S. In the case of an equality `a == b`it does not matter what to return.
P.D: En el caso de una igualdad `a == b`No importa qué devuelva.
6 changes: 3 additions & 3 deletions1-js/02-first-steps/15-function-basics/3-min/task.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,11 +2,11 @@ importance: 1

---

#Function min(a, b)
#Función min(a, b)

Write a function `min(a,b)`which returns the least of two numbers`a`and `b`.
Escriba una función `min(a,b)`la cual devuelva el menor de dos números`a`y `b`.

For instance:
Por ejemplo:

```js
min(2, 5) == 2
Expand Down
4 changes: 2 additions & 2 deletions1-js/02-first-steps/15-function-basics/4-pow/solution.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,8 +14,8 @@ let x = prompt("x?", '');
let n = prompt("n?", '');

if (n < 1) {
alert(`Power ${n}is not supported,
usean integer greater than 0`);
alert(`Potencia ${n}no soportada,
useun entero mayor a 0`);
} else {
alert( pow(x, n) );
}
Expand Down
6 changes: 3 additions & 3 deletions1-js/02-first-steps/15-function-basics/4-pow/task.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,16 +4,16 @@ importance: 4

# Function pow(x,n)

Write a function `pow(x,n)`that returns `x`in power`n`.Or, in other words, multiplies `x`by itself`n`times and returns the result.
Escriba la función `pow(x,n)`que devuelva `x`como potencia de`n`.O, en otras palabras, multiplique `x`por si mismo`n`veces y devuelva el resultado.

```js
pow(3, 2) = 3 * 3 = 9
pow(3, 3) = 3 * 3 * 3 = 27
pow(1, 100) = 1 * 1 * ...* 1 = 1
```

Create aweb-page that prompts for`x`and `n`,and then shows the result of `pow(x,n)`.
Cree una páginaweb que solicite`x`y `n`,y luego muestra el resultado de `pow(x,n)`.

[demo]

P.S. In this task the function should support only natural values of `n`:integers up from `1`.
PD: En esta tarea, la función solo debe admitir valores naturales de `n`:enteros hacia por encima de `1`.
Loading

[8]ページ先頭

©2009-2025 Movatter.jp