-
Notifications
You must be signed in to change notification settings - Fork 1
checkStringLength
Yousif Al-Raheem edited this page Jan 20, 2020
·
3 revisions
This helper function takes a string, compare and validate whether its length falls within a certain range length-wise. Given the min and max lengths, the function returns true if the length is greater than the min and less than the max, false otherwise.
const str = "stringLength"
const result1 = checkStringLength(str, 3, 6);
console.log(result1); // false
const result12 = checkStringLength(str, 3, 10);
console.log(result2); // true
Param | Type | Description |
---|---|---|
str | string | The string object or variable whose length is to be validated |
min | number | The min length of the string |
max | number | The max length of the string |