Skip to content

Instantly share code, notes, and snippets.

@stivncastillo
Last active August 23, 2018 05:35
Show Gist options
  • Save stivncastillo/e2f15ead0c5721398a203769ba4fefcf to your computer and use it in GitHub Desktop.
Save stivncastillo/e2f15ead0c5721398a203769ba4fefcf to your computer and use it in GitHub Desktop.
Ejercicios para la el curso de React para la primer clase de ES6

Ejercicio 1

Teniendo en cuenta los datos dados al principio del código, use un Template String para producir la siguiente cadena. Asegúrese de que los números, los nombres y el rol realmente provengan de los datos.

Hay 4 personas en el equipo.
Sus nombres son Stiven, Maria, Joaquín, Javier.
2 de ellos tienen el rol administrator.

Código

const people = [{name: "Stiven", role: "administrator"},
                {name: "María", role: "writer"},
                {name: "Joaquín", role: "administrator"},
                {name: "Javier", role: "writer"}]

let message = YOUR_CODE_HERE

console.log(message)

Ejercicio 2

Escriba una expresión usando métodos de array de orden superior (por ejemplo, filter y reduce) para calcular el valor total de las máquinas (machine) en la matriz de inventory.

Código

const inventory = [
  {type:   "machine", value: 5000},
  {type:   "machine", value:  650},
  {type:      "duck", value:   10},
  {type: "furniture", value: 1200},
  {type:   "machine", value:   77}
]

let totalMachineValue = YOUR_CODE_HERE

console.log(totalMachineValue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment