ES6字符串新增功能-判断字符串开头及结尾
//startsWith 判断以什么字符串开头
//endsWith 判断以什么字符串结尾
let url = "https://www.lmonkey.com";
if(url.startsWith("https")) {
console.log(url);
}else{
console.log("不是以https开头的");
}
if(url.endsWith('cn')) {
console.log(url);
}else{
console.log("不是以.cn结尾的URL");
}