Modifying the Last Character

Published by Nomore 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

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