9 pts Create a function that takes a string (code), and returns a new string. The given string (code) will have multiple pairs of a letter followed by a number. The number represents how many times the paired letter should be added, in sequence, to the final string. Example: passing "a3b2c1d3" should return "aaabbcddd". You can assume the string will contain at least one letter/number pair, all integers will be 1 digit, and no letters/numbers will be present unless in a pair.
function decodeString(code){ //enter your code below }
Test Cases:
  • decodeString("x3y4") to return xxxyyyy
  • decodeString("U2n1P3") to return UUnPPP
  • decodeString("m1o1t3") to return mottt
00:00 / 03:40

Share the mistake you found and we’ll fix as soon as we can.