Skip to content

fix: remove HTML script tags from JS file and fix bill total accumulation - #952

Open
saurabhhhcodes wants to merge 1 commit into
Anjaliavv51:mainfrom
saurabhhhcodes:fix/Retro-batch-7
Open

fix: remove HTML script tags from JS file and fix bill total accumulation#952
saurabhhhcodes wants to merge 1 commit into
Anjaliavv51:mainfrom
saurabhhhcodes:fix/Retro-batch-7

Conversation

@saurabhhhcodes

Copy link
Copy Markdown

Bugs Fixed

  1. Syntax error in cart.js — Raw HTML <script> tags were embedded inside a .js file (lines 77-100), causing a JavaScript parse error.
  2. Total accumulation buglet total = 0 was declared at module scope and accumulated across every calculateBill() call instead of being reset each time. Also, itemPrices and p lacked const/let declarations, leaking to the global scope.

Changes

  • Removed the script tag block from cart.js
  • Moved total variable inside calculateBill() and added proper const/let declarations

…tion

- Remove raw HTML script tags embedded in cart.js causing syntax error
- Fix calculateBill to use local total instead of global accumulator
- Fix undeclared variables leaking to global scope

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, @saurabhhhcodes! 🎉 Thank you for submitting your pull request. Your contribution is valuable and we appreciate your efforts to improve our project.We will promptly review your changes and offer feedback. Keep up the excellent work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant