# SinglyLinkedListNode | data-structure-typed
Documentation for data-structure-typed

# Class SinglyLinkedListNode<NodeData>

The class which represents one link or node in a linked list

    const node = new SinglyLinkedListNode(1, null, null, null);

#### Type Parameters

- #### NodeData = any

#### Hierarchy

- SinglyLinkedListNode

- Defined in src/data-structures/linked-list/singly-linked-list.ts:12

#####
Index

### Constructors

constructor

### Properties

list
next
prev
val

### Accessors

index
value

### Methods

insertAfter
insertBefore
remove

## Constructors

### constructor

- new SinglyLinkedListNode<NodeData>(val, prev, next, list): SinglyLinkedListNode <NodeData>

- #### Type Parameters

  - #### NodeData = any

  #### Parameters

  - ##### val: NodeData

    Data stored on the node

  - ##### prev: null | SinglyLinkedListNode <NodeData>

    The previous node in the list

  - ##### next: null | SinglyLinkedListNode <NodeData>

    The next link in the list

  - ##### list: null | SinglyLinkedList <NodeData>

    The list this node belongs to

  #### Returns SinglyLinkedListNode <NodeData>

  - Defined in src/data-structures/linked-list/singly-linked-list.ts:13

## Properties

### list

list: null | SinglyLinkedList <NodeData>

The list this node belongs to

- Defined in src/data-structures/linked-list/singly-linked-list.ts:21

### next

next: null | SinglyLinkedListNode <NodeData>

The next link in the list

- Defined in src/data-structures/linked-list/singly-linked-list.ts:19

### prev

prev: null | SinglyLinkedListNode <NodeData>

The previous node in the list

- Defined in src/data-structures/linked-list/singly-linked-list.ts:17

### val

val: NodeData

Data stored on the node

- Defined in src/data-structures/linked-list/singly-linked-list.ts:15

## Accessors

### index

- get index(): undefined | number

- Get the index of this node

      new LinkedList(1, 2, 3).head.index; // 0

  #### Returns undefined | number

  - Defined in src/data-structures/linked-list/singly-linked-list.ts:41

### value

- get value(): NodeData

- Alias to .val

      new LinkedList(1, 2, 3).head.value; // 1

  #### Returns NodeData

  - Defined in src/data-structures/linked-list/singly-linked-list.ts:31

## Methods

### insertAfter

- insertAfter(val): SinglyLinkedList <NodeData>

- Insert new val after this node

      new LinkedList(1, 2).tail.insertAfter(3); // 1 <=> 2 <=> 3

  #### Parameters

  - ##### val: NodeData

    Data to be saved in the node

  #### Returns SinglyLinkedList <NodeData>

  - Defined in src/data-structures/linked-list/singly-linked-list.ts:68

### insertBefore

- insertBefore(val): SinglyLinkedList <NodeData>

- Insert a new node before this one

      new LinkedList(2, 3).head.insertBefore(1); // 1 <=> 2 <=> 3

  #### Parameters

  - ##### val: NodeData

    Data to save in the node

  #### Returns SinglyLinkedList <NodeData>

  - Defined in src/data-structures/linked-list/singly-linked-list.ts:55

### remove

- remove(): SinglyLinkedListNode <NodeData>

- Remove this node

      new LinkedList(1, 2, 3, 4).tail.remove(); // 1 <=> 2 <=> 3

  #### Returns SinglyLinkedListNode <NodeData>

  - Defined in src/data-structures/linked-list/singly-linked-list.ts:80

Generated using TypeDoc