Skip to content

Instantly share code, notes, and snippets.

View ahmed025566's full-sized avatar

Ahmed Salah ahmed025566

View GitHub Profile
const pets = ['Cat', 'Dog', 'Bird', 'Fish', 'Frog', 'Hamster', 'Pig', 'Horse', 'Lion', 'Dragon'];
// Print all pets
console.log(pets[0]);
console.log(pets[1]);
console.log(pets[2]);
console.log(pets[3]);
....
It is not DRY and here you can see how to make it DRY :
@ahmed025566
ahmed025566 / js_linked_list.js
Created February 18, 2023 20:37 — forked from bradtraversy/js_linked_list.js
JS Linked List Class
// Construct Single Node
class Node {
constructor(data, next = null) {
this.data = data;
this.next = next;
}
}
// Create/Get/Remove Nodes From Linked List
class LinkedList {