<script>var st="2009-10-20 14:38:40"var et="2009-10-20 15:38:40"var stdt=new Date(st.replace("-","/"))var etdt=new Date(et.replace("-","/"))if(stdt>etdt) alert("开始时间必须小于结束时间")</script>
第二种:直接比较大小即可
<script>var st="2009-10-20 14:38:40"var et="2009-10-20 15:38:40"if(st>et) alert("开始时间必须小于结束时间")</script>
var max = 0var ind = 0
var arr = [0, 9, 5, 7, 20, 19, 12, 200, 5000, 1999, 50000, 999999, 25412, 2554]
for (var i = 0 i < arr.length i++) {
if (max < arr[i]) {
max = arr[i]
ind = i
}
}
console.info("最大值是" + max + "下标为" + ind)
var array = arr.splice(ind, 1)
console.log("数组为" + arr)
console.warn(array)