Loops and Arrays (03_removeFromArray): Add vanilla/low-level nested loop solution
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 75/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- javascript
- Área
- content
Línea de trabajo
Empieza con el archivo de soluciones del ejercicio 03_removeFromArray, que ya contiene las soluciones con forEach + includes y filter + includes, y con la suite de pruebas de ese ejercicio. Decide si la versión con bucles anidados se incluye como alternativa comentada o como primera solución, y luego comprueba que las pruebas existentes pasan. Está terminado cuando la nueva solución está presente con comentarios explicativos sobre el flag de skip y el bucle interno, y las pruebas de 03_removeFromArray siguen pasando.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Prerequisites
- I have thoroughly read and understand The Odin Project Contributing Guide
- I have searched the existing issues to ensure this improvement hasn't been suggested before (please have a look through our open issues list to make sure)
- The title of this issue follows the
<Location of the improvement>: <Brief description of the improvement>format, e.g.Exercises: Add exercise on XYZ - (Optional) I am interested in working on this issue and would like to be assigned to it
Improvement Description
I would like to propose adding a third, "vanilla/low-level" solution to the 03_removeFromArray exercise.
Currently, the file provides two solutions: one using .forEach() + .includes(), and a more advanced one using .filter() + .includes(). While these are great, both rely on high-level built-in methods (.includes).
Adding an imperative solution using nested loops and a flag would be highly beneficial for beginners. It demonstrates how array filtering works "under the hood" at a foundational level using only basic language constructs (for...of, conditions, and flags) without relying on any built-in lookup methods.
Acceptance Criteria
• Add the nested loops solution as an alternative commented-out approach or as the initial basic approach in the solutions file.
• Ensure the solution passes all existing test suites for 03_removeFromArray.
• Provide clear code comments explaining the algorithmic logic (e.g., the purpose of the skip flag and the inner loop breakdown).
(Optional) Additional Comments
Here is the proposed implementation for the additional solution:
const removeFromArray = function (arr, ...toDelete) {
const deletedArr = [];
for (const elementArr of arr) {
let skip = false;
// Manually checking for inclusion without using .includes()
for (const elementDelete of toDelete) {
if (elementArr === elementDelete) {
skip = true;
break; // Stop looking if a match is found
}
}
// Only push if the element was not flagged for deletion
if (!skip) deletedArr.push(elementArr);
}
return deletedArr;
};
Use code with caution.
This approach helps students strengthen their algorithmic thinking and mental models before they fully transition to abstract methods like .filter().
- Lenguaje dominante
- JavaScript
- Estrellas
- 1.7k
- Forks
- 48.9k
- Merge medio
- 10 h 11 min
- PR fusionados (30 d)
- 6
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Issues similares
-
🐞 bug pending triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
CircuitVerse/CircuitVerse#8025 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
schmayterling/hibi#245 ·
Los mantenedores suelen responder en 1 día
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
vercel/ai#23304 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug package:vitest
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
cloudflare/workers-sdk#16255 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Proxy and MCP URLs with an empty authority parse as a different hostPosiblemente ocupada @ericcaiwx-star la tomó hoy. Abiertoclawsweeper:bulk-filed clawsweeper:linked-pr-open clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
openclaw/openclaw-enterprise#2384 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día