Blocking Code

  • "Blocking" code waits for a line to run before moving on to the next task
  • JavaScript shouldn't do this because the page would constantly be frozen
  • Easier to read but does not work in JavaScript
function processFile() {
    const fileData = readFile("budget.txt");
    const largestExpense = determineLargestExpense(fileData);
    updateNetwork(largestExpense);
    console.log("Done processing.")
}

17 / 27