Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Loops and Arrays (03_removeFromArray): Add vanilla/low-level nested loop solution

Abierto Apto para principiantes
#696 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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

Status: Needs Review
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

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.