标签:
function confirmEnding(str, target) {
if (str.substr(str.length - target.length, target.length) === target) return true;
else return false;
}
confirmEnding("Open sesame
", "same");
如confirmEnding("Open sesame", "same")
应该返回true.
标签:
原文地址:http://www.cnblogs.com/RRirring/p/5715133.html