Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:api,这个i小写,避免产生不比较的误会
function blur(ele) {
event.preventDefault();
event.stopPropagation();
console.log(ele.form);
let email = ele.form.email;
let password = ele.form.password;
if (email.value.length === 0) {
alert("邮箱不能为空");
email.focus();
return false;
} else if (password.value.length === 0) {
alert("密码不能为空");
password.focus();
return false;
} else {
alert("验证通过");
}
}
let str = “lb学习字符”;
1.length 长度
console.log(str.length);
2.charAt 索引->元素
console.log(str.charAt(4));
3.indexOf 字符->索引
console.log(str.indexOf("习"));
4.search:indexOf一样,但支持正则等
console.log(str.search("学"));
5.concat;字符串拼装
console.log(str.concat("(", "学习", ")"));
6.replace:替换
console.log(str.replace("字符", "js"));
7.slice:子串,忽略结束索引的值
console.log(str.slice(0, 4));
8.substr:子串,只是需要取几个
console.log(str.substr(0, 3));
9.split:str->Array
console.log(str.split());
console.log(str.split(""));
console.log(str.split("", 3));
10.toLowerCase,toUpperCase 大小写转换
console.log(str.toLowerCase());
console.log(str.toUpperCase());
11.与html相关 link:加链接 bold:加粗 anchor:锚点
console.log(str.link("https://php.cn"));
console.log(str.bold());
console.log(str.anchor("url"));