-
Notifications
You must be signed in to change notification settings - Fork 62
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
funcionando a-z z-a #33
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se nota el trabajo y el research, muy buen uso del lenguaje Vero! sigue explorado los métodos del array como "includes" hay muchos más que te permitirán hacer cosas más complejas de forma más fácil.
@@ -16,8 +22,8 @@ export const filterSpecies = (rickandmorty, value) => { | |||
const array = []; | |||
|
|||
rickandmorty.forEach((object) => { | |||
object.species.forEach((species) => { | |||
if (species === value) { | |||
object.species.forEach((select_species) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La semántica está bien, pero intenta usar más camelCase, el estilo que usas es el que python suele usar (_)
const array = []; | ||
|
||
rickandmorty.find(object => object.name === value); | ||
return array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esto siempre se devuelve vacío, es esa la intención? porque el resultado de .find es ignorado.
<option class="select-o" value="">Status</option> | ||
<option class="select-o" value="Alive">Alive</option> | ||
<option class="select-o" value="Dead">Dead</option> | ||
<option class="select-o" value="unknown">unknown</option> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No temas agrgar la segunda palabra en vez de solo una letra, porque al agregar semántica permites que sea más legible
src/main.js
Outdated
import { | ||
filterName, | ||
asc, | ||
des, | ||
filterSpecies, | ||
filterStatus, | ||
} from "./data.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muy bien los imports, esto se llama "destructuring"
@@ -96,8 +97,8 @@ | |||
|
|||
//Monstrando por especie |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
El cometar así tus funciones es muy útil, sigue haciendolo.
.sort-style:hover{ | ||
border: 1px solid #E4FFE7; | ||
} | ||
.sort-style .option{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muy bien la especificidad!
const array = rickandmorty.sort((object1, object2) => ((object1.name > object2.name) ? -1 : 1)); | ||
return array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puedes ahorrarte 1 linea, muy bien por el uso de sort
src/data.js
Outdated
rickandmorty.forEach((object) => { | ||
object.status.forEach((status) => { | ||
if (status === value){ | ||
array.push | ||
} | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bien por la solución con 2 ciclos, pero siempre puedes ahorrarte 1 con el método .includes()
del array quedaría en 1 línea:
export const filterStatus = (rickandmorty,value)=>rickandmorty.filter(obj=>obj.status.includes(value))
JAVASCRIPT:
at data.js:19
at Array.forEach ()
at filterSpecies (data.js:18)
at HTMLSelectElement. (main.js:108)
CSS:
Muchas gracias por los comentarios y demás, buena noche!