[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"academy-blogs-en-1-1-all-debugging-go-vs-javascript-all--*":3,"academy-blog-translations-o6k59uedcluwvhh":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,"published_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.17 Debugging Code in Go and JavaScript","sclblg987654321","school_blog_translations","\u003Cp>Debugging is an essential process in software development that helps identify and fix issues in the code effectively. Go and JavaScript each have their own debugging tools and techniques. In this article, we’ll explore how debugging works in both languages, along with examples and tools that can assist in inspecting and fixing errors in the code.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>Debugging in Go\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>Using Print Statements\u003C\u002Fh3>\u003Cp>In Go, debugging typically begins with using print statements to show the values of variables at different points in the code.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>Example of debugging with print statements:\u003C\u002Fh3>\u003Cpre>\u003Ccode class=\"language-plaintext language-go\">package main\n\nimport \"fmt\"\n\nfunc add(a, b int) int {\n    fmt.Println(\"Adding:\", a, b) \u002F\u002F Print the values of a and b before calculation\n    return a + b\n}\n\nfunc main() {\n    result := add(3, 4)\n    fmt.Println(\"Result:\", result)\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Advantages:\u003Cbr>✨ Simple and convenient to check variable values during execution.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Disadvantages:\u003Cbr>⚠️ Makes the code cluttered and needs to be removed after debugging.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>Using Delve (Debugging Tool)\u003C\u002Fh3>\u003Cp>Delve is a tool specifically used for debugging Go code. It allows you to pause the program at specific points and inspect variable values.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Installing Delve:\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"language-plaintext language-bash\">go get -u github.com\u002Fgo-delve\u002Fdelve\u002Fcmd\u002Fdlv\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>Example of debugging with Delve:\u003C\u002Fh3>\u003Cpre>\u003Ccode class=\"language-plaintext language-bash\">dlv debug main.go\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Advantages:\u003Cbr>✨ Allows you to pause the program and inspect operations at specific points.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Disadvantages:\u003Cbr>⚠️ Requires additional tool installation and learning how to use it.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>Debugging in JavaScript\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>Using Console.log\u003C\u002Fh3>\u003Cp>In JavaScript, the simplest debugging method is using \u003Ccode inline=\"\">console.log()\u003C\u002Fcode> to print the values of variables or messages at various stages of the program.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>Example of debugging with console.log:\u003C\u002Fh3>\u003Cpre>\u003Ccode class=\"language-javascript\">function add(a, b) {\n    console.log(\"Adding:\", a, b);  \u002F\u002F Print the values of a and b\n    return a + b;\n}\n\nlet result = add(3, 4);\nconsole.log(\"Result:\", result);\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Advantages:\u003Cbr>✨ Easy to use without installing additional tools.\u003Cbr>✨ Can be used anywhere in the code.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Disadvantages:\u003Cbr>⚠️ In large projects, it can clutter the code and make it harder to read.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>Using Debugger in Browser DevTools\u003C\u002Fh3>\u003Cp>Browser Developer Tools (e.g., Chrome) include a Debugger that helps you pause the program and inspect values interactively.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>How to use the Debugger in Chrome:\u003C\u002Fp>\u003Col>\u003Cli>Open Developer Tools (F12 or Ctrl + Shift + I).\u003C\u002Fli>\u003Cli>Go to the \"Sources\" tab.\u003C\u002Fli>\u003Cli>Click on the line where you want to pause the program (Set Breakpoint).\u003C\u002Fli>\u003Cli>Run the code in the program.\u003C\u002Fli>\u003C\u002Fol>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Advantages:\u003Cbr>✨ Interactive debugging with the ability to inspect variable values while the program is running.\u003Cbr>✨ Supports step-over, step-into, and watch expressions.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Disadvantages:\u003Cbr>⚠️ Must be used through a browser, and in some cases, you can’t debug code not related to browser-based operations.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>Using Visual Studio Code (VS Code) Debugger\u003C\u002Fh3>\u003Cp>VS Code is an IDE that efficiently supports debugging JavaScript code.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch3>Example of setting up the Debugger in VS Code:\u003C\u002Fh3>\u003Col>\u003Cli>Open the \u003Ccode inline=\"\">launch.json\u003C\u002Fcode> file in the \u003Ccode inline=\"\">.vscode\u003C\u002Fcode> folder and add a new configuration.\u003C\u002Fli>\u003Cli>Select \"JavaScript (Node.js)\" for Node.js projects.\u003C\u002Fli>\u003Cli>Use breakpoints to pause the program at specific points.\u003C\u002Fli>\u003C\u002Fol>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Advantages:\u003Cbr>✨ Convenient for debugging Node.js or JavaScript running in a browser.\u003Cbr>✨ Easy to use in VS Code.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Disadvantages:\u003Cbr>⚠️ Requires installation and proper setup of VS Code.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>Comparing Debugging in Go and JavaScript\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cfigure class=\"table\">\u003Ctable>\u003Cthead>\u003Ctr>\u003Cth>Feature\u003C\u002Fth>\u003Cth>Go\u003C\u002Fth>\u003Cth>JavaScript\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Main Debugging Tools\u003C\u002Ftd>\u003Ctd>Delve, Print Statements\u003C\u002Ftd>\u003Ctd>Console.log, Browser DevTools, VS Code Debugger\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Ease of Use\u003C\u002Ftd>\u003Ctd>Requires special tools like Delve\u003C\u002Ftd>\u003Ctd>Easy to use via console.log or DevTools\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Flexibility\u003C\u002Ftd>\u003Ctd>Interactive debugging via Delve\u003C\u002Ftd>\u003Ctd>Can stop and inspect directly in DevTools\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Best for\u003C\u002Ftd>\u003Ctd>Large systems, strict typing\u003C\u002Ftd>\u003Ctd>Web apps, flexible OOP\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Limitations\u003C\u002Ftd>\u003Ctd>Need to learn extra tools\u003C\u002Ftd>\u003Ctd>No advanced features in some cases (e.g., multiple breakpoints)\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003C\u002Ffigure>\u003Cp>&nbsp;\u003C\u002Fp>\u003Chr>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>Summary and Recommendations\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>Go uses the Delve tool, which provides an efficient way to debug code and inspect errors thoroughly, especially in large and complex systems.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>JavaScript uses console.log for simple code debugging or DevTools in browsers for interactive debugging.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>If you are developing a large project in Go, it is recommended to use Delve for debugging. Meanwhile, JavaScript uses DevTools for debugging in web applications or browser-based projects.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Ch2>Next Episode:\u003C\u002Fh2>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>In EP.18 of the JS2GO series, we will dive into code formatting and linting in Go and JavaScript to help ensure your code is clean and of high quality.\u003C\u002Fp>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>If you want to learn about debugging code in Go and JavaScript and improve your programming skills, Superdev Academy is here to help! Sign up with us today!\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\u002Fsuperdevacademy\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>","34_11zon_kyy6ytfcyg.webp","https:\u002F\u002Ftwsme-r2.tumwebsme.com\u002Fsclblg987654321\u002Fw4dkzebeez7f813\u002F34_11zon_kyy6ytfcyg.webp","2026-03-04 08:46:41.544Z","",{"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:11.547Z","ey3puyme01a9bsw","Go","2026-04-10 16:07:25.893Z",{"collectionId":17,"collectionName":18,"created":24,"created_by":13,"id":25,"name":26,"updated":27,"updated_by":13},"2026-03-04 08:20:42.484Z","vslzz9nvv6n77cx","JavaScript","2026-04-10 16:07:28.339Z",{"collectionId":17,"collectionName":18,"created":29,"created_by":13,"id":30,"name":31,"updated":32,"updated_by":13},"2026-03-04 08:46:39.683Z","r1jmeyzcct6audn","VS Code Debugger","2026-04-10 16:13:17.119Z",{"collectionId":17,"collectionName":18,"created":34,"created_by":13,"id":35,"name":36,"updated":37,"updated_by":13},"2026-03-04 08:46:40.078Z","26nqir3wf6rlsa1","Debugging","2026-04-10 16:13:17.225Z",{"collectionId":17,"collectionName":18,"created":39,"created_by":13,"id":40,"name":41,"updated":42,"updated_by":13},"2026-03-04 08:46:40.378Z","ryqnoutln3tgi21","Code Debugging","2026-04-10 16:13:17.314Z",{"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-25 02:32:14.339Z","o6k59uedcluwvhh",209,"w4dkzebeez7f813",[20,25,30,35,40],"2025-09-03 06:34:36.778Z","Debugging code is an essential step in software development. This article compares the debugging tools and methods in Go and JavaScript, highlighting the pros and cons of each language's debugging tools.","debugging-go-vs-javascript","2026-04-25 02:48:06.827Z",1,{"en":77}]