Having Trouble with Error Message

Link to coding challenge. Training on Mumbling | Codewars

The logic is this — every time you loop, it will repeat the string.

I’ve done good so far at breaking down the problem. I am receiving this error when trying to test it (note: clicking “test” is broken and is a known issue with this Kata. Hit “submit” to see what I mean :smiley: )

	const split = s.split("");
  let myString = "";
  for (let i = 0; i < split.length; i++) {
    let result = split[i].repeat(i + 1);

TypeError: myString.push is not a function
    at accum (test.js:11:14)
    at Context.<anonymous> (test.js:20:20)
    at processImmediate (internal/timers.js:464:21)

Is it because it’s not an array? :stuck_out_tongue:

You initialized myString as a string, so no it is not an array. Initialize it as an array and you can use the push method.

Use + or += to concatenate one string to another:

   let str = 'Every statement need a period';
   str += '.';