Make a function that returns the string given the position you want “T” to be in.
function positionT(index, length){
var str="";
for(var i=0; i< length; i++){
if(i===index){
str+='T'
} else {
str+='_'
}}
return str;
}
positionT(1,5) // returns "_T___"
positionT(2,5) // returns "__T__"
solved How to make a letter move foward by one space with Javascript? [closed]