Troubleshooting and Optimizing Chart Rendering in JavaScript Code

The State Changers met to discuss and fix an issue they had previously encountered where a chart sometimes loads the correct data and sometimes it doesn’t. They discovered that the problem might be due to variable loading onto the page before it is drawn. They spent a considerable amount of time thoroughly going over the code, trying to identify the source of the problem and how the function was being called.

In their discussion, they reviewed the terms "async" and "await" in JavaScript, which essentially allow the code to run faster by not blocking the user's interaction while network calls are made. Another feature they mapped out was the "Guard Pattern," which in JavaScript allows for an immediate return under certain conditions, avoiding executing the rest of the function. The State Changers utilized a lot of indentation, trial and error, and validated their work frequently with console.log() to ensure it was functioning correctly. Although they were able to fix the function running issue by adding early return scenarios to check for undefined variables, they still encountered a computation error causing a variable to always return as negative nine-nine-nine. Their next step would be to fix this calculation error. Specific terms and software mentioned includes: JavaScript, async function, await syntax, console.log(), calculation error, console errors, variables, function calls, and undefined.

(Source: Office Hours 8/14/23 )

State Change Members Can View The Video Here

View This Video Now

Join State Change Risk-Free