forked from b00tc4mp/isdi-bootcamp-202501
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dalle-31
committed
Jan 22, 2025
1 parent
28aa83f
commit 17b4a56
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# javascript | ||
|
||
![js logo](https://upload.wikimedia.org/wikipedia/commons/thumb/6/6a/JavaScript-logo.png/600px-JavaScript-logo.png) | ||
|
||
## Saludo | ||
```sh | ||
console.log("¡Hola, mundo!"); | ||
``` | ||
## Suma | ||
```sh | ||
const suma = 10 + 15 | ||
``` | ||
## Multiplicar | ||
```sh | ||
var numbers = [2, 4, 6, 8] | ||
|
||
function multipyByTwo (numbers) { | ||
var result = numbers.map(function(number) { | ||
return number * 2 | ||
}) | ||
return result | ||
} | ||
|
||
multipyByTwo(numbers) | ||
``` | ||
## Longitud de cadena | ||
```sh | ||
let NameLength = 0; | ||
const Name = "Lovelace"; | ||
|
||
NameLength = Name.length; | ||
``` | ||
## Push | ||
```sh | ||
let frutas = ["manzana", "banana", "cereza"]; | ||
frutas.push("naranja"); | ||
console.log(frutas); // ["manzana", "banana", "cereza", "naranja"] | ||
``` | ||
## Arreglo | ||
```sh | ||
let arr = ["Pablo", "Lucas", "Juan",]; | ||
console.log(arr[0]); // Pablo | ||
console.log(arr[2]); // Juan | ||
``` | ||
## Map | ||
```sh | ||
let usuarios = [ | ||
{firstName : "Susan", lastName: "Steward"}, | ||
{firstName : "Daniel", lastName: "Longbottom"}, | ||
]; | ||
|
||
let nombresCompletos = usuarios.map(function(elemento) { | ||
return `${elemento.firstName} ${elemento.lastName}`; | ||
}); | ||
|
||
console.log(nombresCompletos); | ||
// ["Susan Steward", "Daniel Longbottom"] | ||
``` | ||
## |