Created
October 19, 2018 09:21
-
-
Save deepakkadarivel/158fb8eb0dfb6788a2e663d401f270fa to your computer and use it in GitHub Desktop.
Validation logic check. [add your bin description] // source https://jsbin.com/gelidak
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta name="description" content="[add your bin description]"> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>Validation logic check.</title> | |
| </head> | |
| <body> | |
| <script id="jsbin-javascript"> | |
| function minLength(min, value) { | |
| return ((value && value.toString().length >= min) || !value) ? undefined : 'invalid'; | |
| } | |
| function minLengthNew(min, value) { | |
| return (value && value.toString().length < min) ? 'invalid' : undefined; | |
| } | |
| console.log(minLength(3, '12')); | |
| console.log(minLength(3)); | |
| console.log(minLengthNew(3, '12')); | |
| console.log(minLengthNew(3)); | |
| </script> | |
| <script id="jsbin-source-javascript" type="text/javascript">function minLength(min, value) { | |
| return ((value && value.toString().length >= min) || !value) ? undefined : 'invalid'; | |
| } | |
| function minLengthNew(min, value) { | |
| return (value && value.toString().length < min) ? 'invalid' : undefined; | |
| } | |
| console.log(minLength(3, '12')); | |
| console.log(minLength(3)); | |
| console.log(minLengthNew(3, '12')); | |
| console.log(minLengthNew(3));</script></body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function minLength(min, value) { | |
| return ((value && value.toString().length >= min) || !value) ? undefined : 'invalid'; | |
| } | |
| function minLengthNew(min, value) { | |
| return (value && value.toString().length < min) ? 'invalid' : undefined; | |
| } | |
| console.log(minLength(3, '12')); | |
| console.log(minLength(3)); | |
| console.log(minLengthNew(3, '12')); | |
| console.log(minLengthNew(3)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment