- 1.
- var arr_start = ["09:30:00","10:00:00","15:30:00"];
- var arr_end = ["19:00:00","13:30:00"];
- alert(start.substring(11,19));
- alert(arr_start.inArray(start.substring(11,19)))
- //判断字符串是否存在数组中
- Array.prototype.inArray=function(e){
- for(i=0;i<this.length && this[i]!=e;i++);
- return !(i==this.length);
- }
- 另一种
- Array.prototype.in_array = function(e)
- {
- for(i=0;i<this.length;i++)
- {
- if(this[i] == e)
- return true;
- }
- return false;
- }
- //该片段来自于http://www.codesnippet.cn/detail/2601201614486.html
来源: http://www.codesnippet.cn/detail/2601201614486.html