---
id: 69a04088e600bd8074a9852f
title: Step 17
challengeType: 1
dashedName: step-17
---

# --description--

If `current` is `null`, it means that's the end of the list, so the function should stop running.

Create an `if` statement that checks if `current` is strictly equal to `null`. Inside the `if` statement, use `return` to exit the function.

# --hints--

You should create an `if` statement with the condition `current === null`.

```js
assert.match(__helpers.removeJSComments(remove.toString()), /if\s*\(current\s*===\s*null\s*\)\s*\{\s*/);
```

You should use the `return` keyword inside your `if` statement.

```js
assert.match(__helpers.removeJSComments(remove.toString()), /if\s*\(current\s*===\s*null\s*\)\s*\{\s*return;?\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;

    while (current !== null && current.element !== element) {
        previous = current;
        current = 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))
```
