This is an exercise for practice ECMAScript 6 features like map, filter, reduce, sort and ternary operators (It's mandatory to use them to manipulate arrays) for, forEach and if/else it's not allowed .It has empty functions that you should complete and run the tests, you can add parameters. It has a data file that contains songs information and your goal is to pass all tests, you don't have to show anything on the screen.
Fork this repo into your Github account.
- npm install
- npm test
Use the tests/songs.test.js file to know exactly what you are asked to do but don't modify that file. Write your code in the src/song.js file.
- Exercise 1: funtion getAllArtists() -> write the code that gets all artists into an array.
- Exercise 2: funtion getSongsFromArtist() -> return the objects that contains the song of a certain artist.
- Exercise 3: funtion orderAlphabetically() -> alphabetic order the array by title.
- Exercise 4: funtion orderByYear() -> order the array by year, ascending.
- Exercise 5: funtion songsByGenre() -> filter songs by a certain genre.
- Exercise 6: funtion minutsToSeconds() -> modify the duration of songs to seconds.
- Exercise 7: funtion getLongestSong() -> get the longest song.
- Exercise 8: function getShortestSong() -> get the shortest song. Write the test and function.
Este es un ejercicio para practicar las funcionalidades de ECMAScript 6 tales como map, filter, reduce, sort y condicionales ternarios (Su uso es obligatorio para manipular los arrays) las funcionalidades de for, forEach y if/else no est谩n permitidas. Las funciones ya est谩n declaradas y se deber谩 a帽adir el c贸digo y pasar los tests, est谩 permitido a帽adir par谩metros si se necesita. Existe un archivo deta.js que contiene un array de objetos con canciones y el objetivo del ejercicio es pasar todos los tests. No es necesario mostrar nada en pantalla.
Hacer un fork de este repositorio en tu cuenta de Github.
- npm install
- npm test
Clona tu repo en tu visual studio code e instala node (npm install), corre los tests (npm test) para mirar lo que est谩 fallando. Usa el archivo tests/songs.test.js para saber exactamente lo que se te pide pero no puedes modificar este archivo. Escribe tu c贸digo en el archivo src/song.js file.
- Ejercicio 1: funci贸n getAllArtists() -> escribe el c贸digo para obtener un array solo de artistas.
- Ejercicio 2: funci贸n getSongsFromArtist() -> retorna todo el objeto que contiene las canciones de un artista determinado.
- Ejercicio 3: funci贸n orderAlphabetically() -> ordena el array por t铆tulo alfab茅ticamente.
- Ejercicio 4: funci贸n orderByYear() -> ordena el array por a帽o en orden ascendente.
- Ejercicio 5: funci贸n songsByGenre() -> filtra las canciones por g茅nero determinado.
- Ejercicio 6: funci贸n minutsToSeconds() -> modifica la duraci贸n de las canciones a segundos.
- Ejercicio 7: funci贸n getLongestSong() -> obtiene la canci贸n con mayor duraci贸n en segundos.
- Ejercicio 8: funci贸n getShortestSong() -> obtiene la canci贸n con menor duraci贸n en segundos. Escribe el test y la funci贸n.