Skip to content

Convert prompt inputs to numbers with unary plus#3977

Open
Lk-ux wants to merge 1 commit into
javascript-tutorial:masterfrom
Lk-ux:patch-3
Open

Convert prompt inputs to numbers with unary plus#3977
Lk-ux wants to merge 1 commit into
javascript-tutorial:masterfrom
Lk-ux:patch-3

Conversation

@Lk-ux

@Lk-ux Lk-ux commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

The task description says the function should take natural numbers only, but prompt() returns String, which we pass to pow().
It accidentally works because we use *= operator which performs implicit conversion.
But it is best to convert explicitly to improve code readability and align better with the task requirement.

Added unary plus to prompt inputs for type conversion.
@javascript-translate-bot javascript-translate-bot added review needed Review needed, please approve or request changes labels Jul 4, 2026
@javascript-translate-bot javascript-translate-bot requested a review from a team July 4, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review needed Review needed, please approve or request changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants