[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"academy-blogs-en-1-1-all-linked-lists-in-go-vs-javascript-all--*":3,"academy-blog-translations-2h0eeq8bx7mfip0":80},{"data":4,"page":79,"perPage":79,"totalItems":79,"totalPages":79},[5],{"alt":6,"collectionId":7,"collectionName":8,"content":9,"cover_image":10,"cover_image_path":11,"created":12,"created_by":13,"expand":14,"id":73,"keywords":74,"locale":49,"publish_at":75,"scheduled_at":13,"school_blog":71,"short_description":76,"slug":77,"status":69,"title":6,"updated":78,"updated_by":13,"views":72},"JS2GO EP.32 Using Linked Lists in Go vs JavaScript","sclblg987654321","school_blog_translations","\u003Cp>A Linked List is a dynamic data structure used to store data where each node is connected (linked) to the next one using a pointer or reference. This structure allows fast insertion and deletion of data compared to arrays in many cases.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>In this article, we’ll explore how to create and use Linked Lists in JavaScript and Go, with practical code examples and best practices for real-world applications. 🚀\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>1. Concept of Linked Lists\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>A Linked List consists of three main components:\u003C\u002Fp>\u003Cul>\u003Cli>Node: Stores the data and a pointer\u002Freference to the next node.\u003C\u002Fli>\u003Cli>Head: The first node in the list.\u003C\u002Fli>\u003Cli>Tail: The last node, whose pointer points to \u003Ccode inline=\"\">null\u003C\u002Fcode> (in JS) or \u003Ccode inline=\"\">nil\u003C\u002Fcode> (in Go).\u003C\u002Fli>\u003C\u002Ful>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Types of Linked Lists:\u003C\u002Fp>\u003Cul>\u003Cli>Singly Linked List: Each node points only to the next one.\u003C\u002Fli>\u003Cli>Doubly Linked List: Each node points to both the previous and the next node.\u003C\u002Fli>\u003C\u002Ful>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>2. Linked List in JavaScript\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>JavaScript doesn’t have a built-in Linked List, but you can easily implement one using a class.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>🔹 Example: Singly Linked List\u003C\u002Fh3>\u003Cpre>\u003Ccode class=\"language-javascript\">class Node {\n  constructor(value) {\n    this.value = value;\n    this.next = null;\n  }\n}\n\nclass LinkedList {\n  constructor() {\n    this.head = null;\n  }\n\n  append(value) {\n    const newNode = new Node(value);\n    if (!this.head) {\n      this.head = newNode;\n      return;\n    }\n    let current = this.head;\n    while (current.next) {\n      current = current.next;\n    }\n    current.next = newNode;\n  }\n\n  print() {\n    let current = this.head;\n    while (current) {\n      console.log(current.value);\n      current = current.next;\n    }\n  }\n}\n\n\u002F\u002F Test\nconst list = new LinkedList();\nlist.append(10);\nlist.append(20);\nlist.append(30);\nlist.print();\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Output:\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"language-plaintext\">10\n20\n30\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Advantages (JavaScript):\u003Cbr>✔️ Easy to write and understand using \u003Ccode inline=\"\">class\u003C\u002Fcode> syntax\u003Cbr>✔️ Dynamic structure that resizes automatically\u003Cbr>✔️ Ideal for frequent insert\u002Fdelete operations\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Limitations:\u003Cbr>⚠️ No type checking\u003Cbr>⚠️ No built-in Linked List structure in JavaScript\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>3. Linked List in Go\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Go provides a built-in package \u003Ccode inline=\"\">container\u002Flist\u003C\u002Fcode> for working with Linked Lists directly.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>🔹 Example: Using \u003Ccode inline=\"\">container\u002Flist\u003C\u002Fcode>\u003C\u002Fh3>\u003Cpre>\u003Ccode class=\"language-plaintext language-go\">package main\n\nimport (\n    \"container\u002Flist\"\n    \"fmt\"\n)\n\nfunc main() {\n    linkedList := list.New()\n    linkedList.PushBack(10)\n    linkedList.PushBack(20)\n    linkedList.PushBack(30)\n\n    for e := linkedList.Front(); e != nil; e = e.Next() {\n        fmt.Println(e.Value)\n    }\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Output:\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"language-plaintext\">10\n20\n30\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>🔹 Example: Custom Implementation\u003C\u002Fh3>\u003Cpre>\u003Ccode class=\"language-plaintext language-go\">package main\n\nimport \"fmt\"\n\ntype Node struct {\n    Value int\n    Next  *Node\n}\n\ntype LinkedList struct {\n    Head *Node\n}\n\nfunc (l *LinkedList) Append(value int) {\n    newNode := &amp;Node{Value: value}\n    if l.Head == nil {\n        l.Head = newNode\n        return\n    }\n    current := l.Head\n    for current.Next != nil {\n        current = current.Next\n    }\n    current.Next = newNode\n}\n\nfunc (l *LinkedList) Print() {\n    current := l.Head\n    for current != nil {\n        fmt.Println(current.Value)\n        current = current.Next\n    }\n}\n\nfunc main() {\n    list := LinkedList{}\n    list.Append(10)\n    list.Append(20)\n    list.Append(30)\n    list.Print()\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Advantages (Go):\u003Cbr>✔️ Type-safe with compile-time checking\u003Cbr>✔️ Efficient and memory-optimized\u003Cbr>✔️ Suitable for backend and high-performance systems\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Limitations:\u003Cbr>⚠️ Syntax is more verbose than JavaScript\u003Cbr>⚠️ Requires manual pointer handling\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>4. Best Practices\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>✔️ Use Linked Lists when frequent insertions or deletions are required — such as in Queues, Stacks, or Scheduling systems.\u003Cbr>✔️ Avoid using them for random access, since traversal through each node is required.\u003Cbr>✔️ Use container\u002Flist in Go if you don’t need to implement from scratch.\u003Cbr>✔️ Use class-based structures in JavaScript for clarity and modularity.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>5. Comparison: JavaScript vs Go\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cfigure class=\"table\">\u003Ctable>\u003Cthead>\u003Ctr>\u003Cth>Feature\u003C\u002Fth>\u003Cth>JavaScript\u003C\u002Fth>\u003Cth>Go\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Structure\u003C\u002Ftd>\u003Ctd>Custom \u003Ccode inline=\"\">class\u003C\u002Fcode>\u003C\u002Ftd>\u003Ctd>Built-in (\u003Ccode inline=\"\">container\u002Flist\u003C\u002Fcode>)\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Type Safety\u003C\u002Ftd>\u003Ctd>Dynamic\u003C\u002Ftd>\u003Ctd>Strongly typed\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Performance\u003C\u002Ftd>\u003Ctd>Moderate\u003C\u002Ftd>\u003Ctd>High efficiency\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Implementation\u003C\u002Ftd>\u003Ctd>Manual (class)\u003C\u002Ftd>\u003Ctd>Built-in or manual\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Best Use Case\u003C\u002Ftd>\u003Ctd>Lightweight data manipulation\u003C\u002Ftd>\u003Ctd>High-performance systems\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003C\u002Ffigure>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>Recommendations\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>💡 Frontend \u002F App-level logic: Use JavaScript \u003Ccode inline=\"\">class\u003C\u002Fcode> for flexibility and readability.\u003Cbr>⚙️ Backend \u002F High-performance systems: Use Go’s \u003Ccode inline=\"\">container\u002Flist\u003C\u002Fcode> or custom implementation for speed and type safety.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Chr>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>Next Episode\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>In EP.33 of the JS2GO Series, we’ll explore 👉 “Using Trees and Graphs in Go and JavaScript” understanding advanced data structures used in real-world systems such as social graphs, file systems, and search algorithms. 🌳\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp data-start=\"498\" data-end=\"834\">\u003Cstrong>Read more\u003C\u002Fstrong>\u003C\u002Fp>\u003Cul>\u003Cli>\u003Cp data-start=\"498\" data-end=\"834\">\u003Ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\u002F\u002Fwww.superdev.school\u002Fblogs\u002Fcategories\u002FGolang\">\u003Cstrong>Golang The Series\u003C\u002Fstrong>\u003C\u002Fa>\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp data-start=\"498\" data-end=\"834\">\u003Ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\u002F\u002Fwww.superdev.school\u002Fblogs\u002Fcategories\u002FJS2GO\">\u003Cstrong>JS2GO\u003C\u002Fstrong>\u003C\u002Fa>\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp data-start=\"498\" data-end=\"834\">\u003Ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\u002F\u002Fwww.superdev.school\u002Fen\u002Fblogs\u002Fcategories\u002FTailwind%20CSS\">\u003Cstrong>10 Eps That Will Make You a Pro Tailwind CSS Overnight\u003C\u002Fstrong>\u003C\u002Fa>\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Cp>\u003Cstrong>🔵 Facebook: \u003C\u002Fstrong>\u003Ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\u002F\u002Fwww.facebook.com\u002Fsuperdev.academy.th\">\u003Cstrong>Superdev Academy\u003C\u002Fstrong>\u003C\u002Fa>\u003C\u002Fp>\u003Cp>\u003Cstrong>🔴 YouTube: \u003C\u002Fstrong>\u003Ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\u002F\u002Fwww.youtube.com\u002Fchannel\u002FUC2eI2RxcA2zbTqZyHyWIfRg\">\u003Cstrong>Superdev Academy\u003C\u002Fstrong>\u003C\u002Fa>\u003C\u002Fp>\u003Cp>\u003Cstrong>📸 Instagram: \u003C\u002Fstrong>\u003Ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\u002F\u002Fwww.instagram.com\u002Fsuperdevschool\u002F\">\u003Cstrong>Superdev Academy\u003C\u002Fstrong>\u003C\u002Fa>\u003C\u002Fp>\u003Cp>\u003Cstrong>🎬 TikTok: \u003C\u002Fstrong>\u003Ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\u002F\u002Fwww.tiktok.com\u002F@superdevacademy?lang=th-TH\">\u003Cstrong>https:\u002F\u002Fwww.tiktok.com\u002F@superdevacademy?lang=th-TH\u003C\u002Fstrong>\u003C\u002Fa>\u003C\u002Fp>\u003Cp>\u003Cstrong>🌐 Website: \u003C\u002Fstrong>\u003Ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\u002F\u002Fwww.superdevacademy.com\u002Fen\">\u003Cstrong>https:\u002F\u002Fwww.superdevacademy.com\u002Fen\u003C\u002Fstrong>\u003C\u002Fa>\u003Cstrong>&nbsp;\u003C\u002Fstrong>\u003C\u002Fp>","64_11zon_napdo7aqe1.webp","https:\u002F\u002Ftwsme-r2.tumwebsme.com\u002Fsclblg987654321\u002Fswcfcodg09w1hcu\u002F64_11zon_napdo7aqe1.webp","2026-03-04 08:45:52.545Z","",{"keywords":15,"locale":43,"school_blog":53},[16,23,28,33,38],{"collectionId":17,"collectionName":18,"created":19,"created_by":13,"id":20,"name":21,"updated":22,"updated_by":13},"sclkey987654321","school_keywords","2026-03-04 08:20:33.316Z","ln1ntwattzmxo0o","programming","2026-04-10 16:07:27.299Z",{"collectionId":17,"collectionName":18,"created":24,"created_by":13,"id":25,"name":26,"updated":27,"updated_by":13},"2026-03-04 08:45:50.341Z","j9ekam1q1mqcs59","Data Structure","2026-04-10 16:13:04.775Z",{"collectionId":17,"collectionName":18,"created":29,"created_by":13,"id":30,"name":31,"updated":32,"updated_by":13},"2026-03-04 08:20:42.484Z","vslzz9nvv6n77cx","JavaScript","2026-04-10 16:07:28.339Z",{"collectionId":17,"collectionName":18,"created":34,"created_by":13,"id":35,"name":36,"updated":37,"updated_by":13},"2026-03-04 08:20:11.547Z","ey3puyme01a9bsw","Go","2026-04-10 16:07:25.893Z",{"collectionId":17,"collectionName":18,"created":39,"created_by":13,"id":40,"name":41,"updated":42,"updated_by":13},"2026-03-04 08:45:51.827Z","52fc1pdblbz5ytk","Linked List","2026-04-10 16:13:05.068Z",{"code":44,"collectionId":45,"collectionName":46,"created":47,"flag":48,"id":49,"is_default":50,"label":51,"updated":52},"en","pbc_1989393366","locales","2026-01-22 11:00:02.726Z","twemoji:flag-united-states","qv9c1llfov2d88z",false,"English","2026-04-10 15:42:46.825Z",{"category":54,"collectionId":55,"collectionName":56,"expand":57,"id":71,"views":72},"hsa1afr8fcnd6qb","pbc_2105096300","school_blogs",{"category":58},{"blogIds":59,"collectionId":60,"collectionName":61,"created":62,"created_by":13,"id":54,"image":63,"image_alt":13,"image_path":64,"label":65,"name":66,"priority":67,"publish_at":68,"scheduled_at":13,"status":69,"updated":70,"updated_by":13},[],"sclcatblg987654321","school_category_blogs","2026-03-04 08:24:37.986Z","js2_go_2_11zon_y6paxmuz32.webp","https:\u002F\u002Ftwsme-r2.tumwebsme.com\u002Fsclcatblg987654321\u002Fhsa1afr8fcnd6qb\u002Fjs2_go_2_11zon_y6paxmuz32.webp",{"en":66,"th":66},"JS2GO",10,"2025-08-11 03:41:08.820Z","published","2026-04-10 16:08:23.388Z","2h0eeq8bx7mfip0",208,"swcfcodg09w1hcu",[20,25,30,35,40],"2025-10-28 01:38:17.772Z","Linked Lists are dynamic data structures that allow fast insertion and deletion of elements. In this article, you’ll learn how to create and use Linked Lists in both JavaScript and Go with real code examples and best practices for real-world applications.","linked-lists-in-go-vs-javascript","2026-04-12 18:16:58.550Z",1,{"en":77}]