Проверьте, заканчивается ли строка (первый аргумент, str ) заданной целевой строкой (второй аргумент, target ). Эта проблема может быть решена с помощью .endsWith() , который был введен в ES2015. Но для этой задачи мы хотели бы, чтобы вы использовали один из методов подстроки JavaScript. Не забудьте использовать Read-Search-Ask, если вы застряли. Напишите свой собственный код.
⌛
confirmEnding("Bastian", "n") should return true.
⌛
confirmEnding("Congratulation", "on") should return true.
⌛
confirmEnding("Connor", "n") should return false.
⌛
confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification") should return false.
⌛
confirmEnding("He has to give me a new name", "name") should return true.
⌛
confirmEnding("Open sesame", "same") should return true.
⌛
confirmEnding("Open sesame", "pen") should return false.
⌛
confirmEnding("Open sesame", "game") should return false.
⌛
confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain") should return false.
⌛
confirmEnding("Abstraction", "action") should return true.
⌛
Do not use the built-in method .endsWith() to solve the challenge.