Questenaتدريب يوضح لك ما ينبغي مراجعته لاحقًا
السؤال 31

Given text = "planet", what does text.slice(1, 4) return, and what happens to text?

  1. lane, with text unchanged
  2. lan, with text unchangedالإجابة الصحيحة
  3. lan, with text shortened
  4. pla, with text unchanged

الشرح

slice starts at index 1 and stops before index 4, producing "lan" while leaving the source unchanged. Including the character at index 4 would wrongly treat the end boundary as inclusive.

تابع هذا الاختبار

بدء التدريب
السؤال 31: Given text = "planet", what does text.slice(1, 4) return,… · JavaScript Fundamentals · Questena