当前位置: 代码迷 >> 综合 >> FreeCodeCamp学习--Confirm the Ending
  详细解决方案

FreeCodeCamp学习--Confirm the Ending

热度:27   发布时间:2023-12-13 08:02:10.0


Confirm the Ending


检查一个字符串(str)是否以指定的字符串(target)结尾。

如果是,返回true;如果不是,返回false。

function confirmEnding(str, target) {// "Never give up and good luck will find you."// -- Falcorvar s=target.length;var s1=str.length;if(str.substr(s1-s)==target)return true;return false;
}confirmEnding("Bastian", "n");


Confirm the Ending


检查一个字符串(str)是否以指定的字符串(target)结尾。

如果是,返回true;如果不是,返回false。

  相关解决方案