---
id: 69a03ddce82b0626f329b001
title: Step 15
challengeType: 1
dashedName: step-15
---

# --description--

Now, create a `while` loop that checks if `current` is not strictly `null` and `current.element` is not strictly equal to element.

This means the loop should continue traversing the list until the end of the list is reached or the element to remove is found.

# --hints--

You should create a `while` loop with the condition `current !== null && current.element !== element`.

```js
assert.match(__helpers.removeJSComments(remove.toString()), /while\s+\(current\s*!==\s*null\s*&&\s*current\.element\s*!==\s*element\)\s*\{\s*/);
```

# --seed--

## --seed-contents--

```js
function initList() {
    return {
        head: null,
        length: 0
    };
}

function isEmpty(list) {
  return list.length === 0;
}

function add(list, element) {
    const node = {
        element: element,
        next: null
    };

    if (isEmpty(list)) {
        list.head = node;
    } else {
        let current = list.head;
        while (current.next !== null) {
            current = current.next;
        }
        current.next = node;
    }

    list.length++;
}

function remove(list, element) {
    let previous = null;
    let current = list.head;

    --fcc-editable-region--
        
    --fcc-editable-region--
}

const myList = initList();
console.log(isEmpty(myList))
add(myList, 42);
add(myList, 43);
add(myList, 44);
console.log(myList)
console.log(isEmpty(myList))
```
