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