Skip to content

Update main.js#16

Open
Om149 wants to merge 1 commit intoWebDevVikramChoudhary:masterfrom
Om149:patch-1
Open

Update main.js#16
Om149 wants to merge 1 commit intoWebDevVikramChoudhary:masterfrom
Om149:patch-1

Conversation

@Om149
Copy link
Copy Markdown

@Om149 Om149 commented Aug 2, 2025

🛠 Refactored calculator logic in main.js

  • Replaced undeclared variables with 'let' for clarity and scope safety
  • Removed unnecessary separate condition for '*'
  • Added try-catch around eval() to prevent crashes on invalid input
  • Updated "=" logic to support expression chaining (e.g. result + 5)
  • Cleaned formatting for better readability

🛠 Refactored calculator logic in main.js

- Replaced undeclared variables with 'let' for clarity and scope safety
- Removed unnecessary separate condition for '*'
- Added try-catch around eval() to prevent crashes on invalid input
- Updated "=" logic to support expression chaining (e.g. result + 5)
- Cleaned formatting for better readability
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