Skip to content

Instantly share code, notes, and snippets.

@hehongwei44
Created July 4, 2014 08:34
Show Gist options
  • Save hehongwei44/005bf7f6836b3064c893 to your computer and use it in GitHub Desktop.
Save hehongwei44/005bf7f6836b3064c893 to your computer and use it in GitHub Desktop.
判断传入的参数的长度是否在给定的有效范围内
/**
*
* @description: 判断传入的参数的长度是否在给定的有效范围内
* @param: minL->给定的最小的长度
* @param: maxL->给定的最大的长度
* @param: str->待验证的参数
* @return : true表示合理,验证通过
*
*/
var isAvaiableLength = function(minL,maxL,str){
return (str.length >= minL && str.length <= maxL) ? true : false;
}
@huangyangme
Copy link

为何你的代码如此之美

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment