JSFiddle - React, Tailwind, and code Playground
by donniec
JavaScript
var sentence = "I_went_to_staton_island_sharon_to";
var newSentence ="";
var indicies=[1,6,9,16,23,30];
for(i = 32; i < 64; i++){
newSentence = sentence;
blah = i.toString(2);
for(s=0; s < 6; s++) {
newSentence = setCharAt(newSentence, indicies[s], blah[s]=='1' ? " " : "*");
}
newSentence = newSentence.replace(/\*/g,'');
console.log(newSentence);
}
function setCharAt(str,index,chr) {
if(index > str.length-1) return str;
return str.substr(0,index) + chr + str.substr(index+1);
}