JSFiddle - React, Tailwind, and code Playground

by epinapala

JavaScript

function test(str1, c){
    var str =  str1.split("");
    var d = 0;
    if(c < 6){
      d = c
    }else{
      d = c%6;
    }
    if (str.length == 1){
        alert(str);
        return str;
    }else{
         alert(str.toString());
        delete str[d-1];
        return test(str.toString(), d);
    }

}

if (!Array.prototype.remove) {
  Array.prototype.remove = function(val) {
    var i = this.indexOf(val);
         return i>-1 ? this.splice(i, 1) : [];
  };
}

test("flames", 6);