I am trying to write a javascript algorithm that checks to see if an array of characters could make a given string.
I decided to go about this by writing a function that converts the array to a string so that I can call the .match() method on that string to search for the characters of the given string.
function arrStr(arr,str) {
cleanArray(arr).match(str) ? true : false
}
function cleanArray(arr){
return arr.join('')
}
When I attempt to execute this algorithm, I keep getting "undefined". Anybody have any ideas as to why? Thank you