Skip to content

Instantly share code, notes, and snippets.

@belichuk
belichuk / index.js
Last active April 26, 2023 17:51
reverse list javascript
class List {
constructor(head = null) {
this.head = head
}
insert(newNode) {
let node = this.head;
if (node==null) {
this.head = newNode;
return;