Skip to content
This repository was archived by the owner on Jul 11, 2026. It is now read-only.

funcionando a-z z-a#33

Open
veroalrodriguez wants to merge 2 commits into
Laboratoria:masterfrom
veroalrodriguez:master
Open

funcionando a-z z-a#33
veroalrodriguez wants to merge 2 commits into
Laboratoria:masterfrom
veroalrodriguez:master

Conversation

@veroalrodriguez

Copy link
Copy Markdown

JAVASCRIPT:

  • Aún no he desarrollado mi buscador por nombre.
  • El filtro de a-z z-a ya funciona.
  • Mis funciones para filtros por especie y estado no jalan, justo así como las tengo, me marca en consola: Uncaught TypeError: object.species.forEach is not a function
    at data.js:19
    at Array.forEach ()
    at filterSpecies (data.js:18)
    at HTMLSelectElement. (main.js:108)

CSS:

  • Si me queda tiempo me gustaría revisar bien el acomodo de mis tarjetas en flexbox. Sé cómo hacerlo, sólo me faltaría tiempo.

Muchas gracias por los comentarios y demás, buena noche!

@HectorBlisS HectorBlisS left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread src/data.js
rickandmorty.forEach((object) => {
object.species.forEach((species) => {
if (species === value) {
object.species.forEach((select_species) => {

Copy link
Copy Markdown
Contributor

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 (_)

Comment thread src/data.js
const array = [];

rickandmorty.find(object => object.name === value);
return array;

Copy link
Copy Markdown
Contributor

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.

Comment thread src/index.html
Comment on lines +90 to +93
<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>

Copy link
Copy Markdown
Contributor

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

Comment thread src/main.js
Comment on lines 66 to 72
import {
filterName,
asc,
des,
filterSpecies,
filterStatus,
} from "./data.js"

Copy link
Copy Markdown
Contributor

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"

Comment thread src/main.js
@@ -96,8 +97,8 @@

//Monstrando por especie

Copy link
Copy Markdown
Contributor

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.

Comment thread src/style.css
.sort-style:hover{
border: 1px solid #E4FFE7;
}
.sort-style .option{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy bien la especificidad!

Comment thread src/data.js
Comment on lines +10 to +11
const array = rickandmorty.sort((object1, object2) => ((object1.name > object2.name) ? -1 : 1));
return array;

Copy link
Copy Markdown
Contributor

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

Comment thread src/data.js
Comment on lines +32 to +38
rickandmorty.forEach((object) => {
object.status.forEach((status) => {
if (status === value){
array.push
}
});
});

Copy link
Copy Markdown
Contributor

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))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants