---
id: 69a046a1a74385bb4be1bb88
title: Step 20
challengeType: 1
dashedName: step-20
---

# --description--

Now, you need to decrement `length` in the `remove` function to keep track of the actual number of elements remaining in the list after removing one.

# --hints--

You should decrement the `length` property of `list` using the decrement operator (`--`). 

```js
assert.match(__helpers.removeJSComments(remove.toString()), /list.length\-\-/);
```

# --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;

    while (current !== null && current.element !== element) {
        previous = current;
        current = current.next; 
    }

    if (current === null) {
        return;
    }

    if(previous !== null) {
        previous.next = current.next;
    } else {
        list.head = current.next;
    }

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