Skip to content

Fix: Remove trailing spaces in numberToEnglish and improve code consistency#7

Open
open-inspect-wesmith4[bot] wants to merge 1 commit into
masterfrom
open-inspect/e22e5db4104de0c3d01c6ccc177c757f
Open

Fix: Remove trailing spaces in numberToEnglish and improve code consistency#7
open-inspect-wesmith4[bot] wants to merge 1 commit into
masterfrom
open-inspect/e22e5db4104de0c3d01c6ccc177c757f

Conversation

@open-inspect-wesmith4

Copy link
Copy Markdown

Summary

This PR addresses the top issues identified in the code review:

  • Fix numberToEnglish output formatting: Add .trim() to remove trailing spaces from the result string
  • Update test assertions: Correct test cases to expect properly formatted output without trailing spaces
  • Improve code consistency: Replace .substring() with .slice() in addCommas for cleaner, more idiomatic JavaScript

Changes

exercises/numberToEnglish/numberToEnglish.js

  • Added .trim() call when joining descriptionWords to eliminate trailing spaces
  • Updated 7 test cases to expect correct output format without trailing spaces

exercises/addCommas/addCommas.js

  • Replaced numberString.substring(0, numberString.length - 3) with numberString.slice(0, -3) for consistency

Testing

All tests pass after changes:

  • ✅ addCommas: 3/3 tests passing
  • ✅ numberToEnglish: 8/8 tests passing

Created with Open-Inspect

…e consistency

- Add .trim() to numberToEnglish result to eliminate trailing spaces
- Update test cases to expect properly formatted output without trailing spaces
- Replace .substring() with .slice() in addCommas for consistency
- All tests now pass with corrected expectations
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.

0 participants