Debugging and Solving Coding Problems with JavaScript and jQuery

In this meeting, State Changers (participants) were debugging a JavaScript function that wasn’t returning the expected output. The function was supposed to send a request to an API and handle the response, but notable insights from the meeting include:


1. Using console.log as a Debugging Tool: State Changers emphasized the necessity of writing console.log in various parts of their code to verify if certain parts are executing correctly. This was repeatedly done to verify if data returned from a particular URL was received and if arrays were forming correctly. 2. Correction of Code Lines: There were certain lines of code where improvements were made like the transformation of a string into a number and a useful clarification regarding the difference of using a comma and plus in console.log was provided. Using a comma treats the variables as separate entities whereas plus concatenates them into a single string and can sometimes lead to unanticipated results when the variable isn’t a string. 3. Understanding the actual response: An issue arose where the page total retrieved from an API was being returned incorrectly. It was treated as a string instead of a number hence the operators were not working as expected. 4. Problems with Code Indentation: The state Changers also discussed how indentation was sometimes causing confusion about what was nested within what part of the code. 5. Use of HTML in jQuery: The participants replaced the word text with HTML at some point to achieve certain desired outputs. 6. Conceptual Question on Displaying Results: It was shown how to change the output to a new line, which involved using the "br" tag correctly as self-closing Overall, the crux of the meeting revolved around troubleshooting a coding problem and using debugging techniques to analyze and rectify the issues.


(Source: Office Hours 11/15 )

State Change Members Can View The Video Here
chris-montgomery-smgTvepind4-unsplash.jpg

View This Video Now

Join State Change Risk-Free