JSFiddle - React, Tailwind, and code Playground
JavaScript
Array.prototype.flatten = function(){
for(var x=0; x<this.length; x++){
if(Array.isArray(this[x])){
this.splice.apply( this,[x,1].concat(this[x]));
if(Array.isArray(this[x])) x--;
}
}
return this;
}
console.log([1,2,3,[[1],2,3]].flatten())