var t=arr[0];
var l=arr[1];
var temp=[];
t=t.toUpperCase();
l=l.toUpperCase();
for(var i=0; i<l.length; i++){
for(var j=0; j<t.length; j++){
if(l[i]==t[j]){
temp.push("t[j]");
}
}
}
var x=temp.length;
var y=arr[1].length;
if(x!=y){
return false;
}
else return true;
}
Do you have a question? (Also, you should really format your code to make it easier to read)
The code works except when the string repeats characters. Also how do I format the code(i thought it was done automatically)?
if the character at position i in array l is in the other array push it into the temp array.
Thanks for the help. What you described is exactly what i’m asking about (hence help with repeated characters). I am asking if there is a simple solution with what i have above or if a different strategy would be easier.