- free code camp,检查字符串结尾,运用string.
- Day07 JavaScript(Algorithm)
- freecodecamp-HTML5 and CSS3-第一课
- free code camp,比较字符串,运用string.in
- Review-The most important skill
- ??Drop it | Free Code Camp
- Hooks 二三事 (1) | 十分钟快速入门 React Ho
- Review-The Key To learning fast
- ??Binary Agents | Free Code Camp
- Profile Lookup | Free Code Camp
检查字符串结尾
判断一个字符串(str)是否以指定的字符串(target)结尾。
如果是,返回true;如果不是,返回false。
function confirmEnding(str,target){
var a=str.substring(str.length-target.length);
if (a==target){
console.log(true);
}else {
console.log(false);
}
}
confirmEnding("He has to give me a new name", "name");
网友评论