AWS Exams GCP Exams Azure Exams GitHub Exams Jira Exams ISC2 Exams

Video: A developer is debugging a JavaScript function github video

Question 1 Be Honest
« Back   Next github copilot-gh-300 Exam Question »
Answer

Full Certification Question

A developer is debugging a JavaScript function that calculates the total price of items in a shopping cart. The function sometimes returns NaN instead of the correct total price. They decide to use GitHub Copilot for assistance. function calculateTotal ( cart ) { let total = 0 ; for ( let item of cart ) { total += item . price * item . quantity ; } return total ; } Which of the following is the best way to use GitHub Copilot to debug and fix this issue?