Modifying the Last Character

Published by Mubashir Hassan in

Create a function which makes the last character of a string repeat n number of times.

Examples

modifyLast("Hello", 3) ➞ "Hellooo"

modifyLast("hey", 6) ➞ "heyyyyyy"

modifyLast("excuse me what?", 5) ➞ "excuse me what?????"

Notes

  • Tests will include numbers and punctuation.
  • Make sure your code is not case sensitive.
Watch a quick demo on how Edabit works.