Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open Beginner friendly
#696 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript
Domain
content

Research direction

Start with the solutions file for the 03_removeFromArray exercise, which already holds the forEach + includes and filter + includes solutions, and the test suite for that exercise. Decide whether the nested-loop version goes in as a commented-out alternative or as the first solution, then check the existing tests pass. Done means the new solution is present with explanatory comments on the skip flag and the inner loop, and the 03_removeFromArray tests still pass.

Written by the indexing model from the issue text.

Description

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

Dominant language
JavaScript
Stars
1.7k
Forks
48.9k
Avg merge
10h 11m
Merged PRs (30d)
6

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.