str
) تنتهي بسلسلة الهدف المحددة (الوسيطة الثانية ، target
). يمكن حل هذا التحدي باستخدام طريقة .endsWith()
، التي تم تقديمها في ES2015. ولكن لغرض هذا التحدي ، نود منك استخدام إحدى طرق السلسلة الفرعية JavaScript بدلاً من ذلك. تذكر استخدام Read-Search-Ask إذا واجهتك مشكلة. اكتب الكود الخاص بك. confirmEnding("Bastian", "n")
يجب أن ترجع true.'
testString: 'assert(confirmEnding("Bastian", "n") === true, "confirmEnding("Bastian", "n")
should return true.");'
- text: 'confirmEnding("Congratulation", "on")
يجب أن تعود إلى true.'
testString: 'assert(confirmEnding("Congratulation", "on") === true, "confirmEnding("Congratulation", "on")
should return true.");'
- text: 'confirmEnding("Connor", "n")
يجب أن ترجع false.'
testString: 'assert(confirmEnding("Connor", "n") === false, "confirmEnding("Connor", "n")
should return false.");'
- text: 'confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification")
يجب أن تعود خاطئة.'
testString: 'assert(confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification") === false, "confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification")
should return false.");'
- text: 'confirmEnding("He has to give me a new name", "name")
يجب أن confirmEnding("He has to give me a new name", "name")
.'
testString: 'assert(confirmEnding("He has to give me a new name", "name") === true, "confirmEnding("He has to give me a new name", "name")
should return true.");'
- text: 'confirmEnding("Open sesame", "same")
يجب أن ترجع true.'
testString: 'assert(confirmEnding("Open sesame", "same") === true, "confirmEnding("Open sesame", "same")
should return true.");'
- text: 'confirmEnding("Open sesame", "pen")
يجب أن يقوم بإرجاع false.'
testString: 'assert(confirmEnding("Open sesame", "pen") === false, "confirmEnding("Open sesame", "pen")
should return false.");'
- text: 'confirmEnding("Open sesame", "game")
يجب أن ترجع false.'
testString: 'assert(confirmEnding("Open sesame", "game") === false, "confirmEnding("Open sesame", "game")
should return false.");'
- text: 'confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain")
يجب أن تعود كاذبة.'
testString: 'assert(confirmEnding("If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing", "mountain") === 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.");'
- text: 'confirmEnding("Abstraction", "action")
يجب أن confirmEnding("Abstraction", "action")
true.'
testString: 'assert(confirmEnding("Abstraction", "action") === true, "confirmEnding("Abstraction", "action")
should return true.");'
- text: لا تستخدم الأسلوب .endsWith()
لحل التحدي.
testString: 'assert(!(/\.endsWith\(.*?\)\s*?;?/.test(code)) && !(/\["endsWith"\]/.test(code)), "Do not use the built-in method .endsWith()
to solve the challenge.");'
```