You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update script.js
- Renamed variable reg to digitLengthRegex to better reflect its purpose.
- Replaced string-based regex ('/^\d{10}$/') with a proper RegExp object.
- Added test cases for strings with 9, 10, and 11 digits to demonstrate expected behavior.
- Improved inline comments.
* Update README.md
Updated the readme to be more descriptive.
Script is used to check if the number has 10 digts( you can update the digit count in the code based on the need.
1
+
# Digit Length Validator
2
+
3
+
## Description
4
+
5
+
This script checks if a string contains exactly a specified number of digits. Useful for validating numeric input. The digit count can be adjusted in the code.
6
+
7
+
## Usage
8
+
To change the required digit count, update the number in the regular expression
9
+
```
10
+
var digitLengthRegex = /^\d{N}$/; // Replace N with desired digit count
0 commit comments