js判断字符串str是否包含字符串substr: function addUser(id,realName){ var userids = $("#userids").val(); if (userids!=""&&userids!=null) { if (!isContains(userids,id)) { userids = userids + id + ","; } }else{ userids = id + ",
var data = “2018-12-09”; //返回为false则是日期格式;isNaN(data)排除data为纯数字的情况(此处不考虑只有年份的日期,如‘2018’) if(isNaN(data)&&!isNaN(Date.parse(data))){ console.log("data是日期格式!") }