Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
JavaScript
/
Data types
A field must contain a complete non-negative decimal integer within the safe range. Which…
from Data types
Node 24
intermediate
1 min
A field must contain a complete non-negative decimal integer within the safe range. Which approach matches that contract?
Validate String(value) with /^(0|[1-9]\\d*)$/, convert with Number, then call Number.isSafeInteger.
Call parseInt(value, 10) and accept any result that is not NaN.
Call Number(value) and accept every finite result.
Use Boolean(value) before Number(value) to reject empty input.
Check
Ask AI about this kata
Report an error
previous kata
Spot the bug in the environment parser
Spot the bug
A new version is available
Reload