Skip to content

Commit 4631be2

Browse files
committed
Added JavaScript example for single linked list
1 parent 17cb038 commit 4631be2

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

JavaScript/1-single.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
function Node(prev, data) {
4+
this.prev = prev;
5+
this.data = data;
6+
}
7+
8+
let n1 = new Node(null, { name: 'first' });
9+
let n2 = new Node(n1, { name: 'second' });
10+
let n3 = new Node(n2, { name: 'third' });
11+
12+
console.dir(n1);
13+
console.dir(n2);
14+
console.dir(n3);
File renamed without changes.

0 commit comments

Comments
 (0)