Hi guys,
I need help with understanding how the forum works when it comes to solutions to challenges.
I was working at this challenge in the basic algorithm javascript:
and I came up with a solution I’d like some feedback on, as I could not find it on the forum. But it doesn’t let me comment or reply to other comments on the solution page for that challenge. So my question is how do I get some feedback on this solution? and if it is a good solution, eventually how do you get it added to the solution list?
I will copy the solution below:
function mutation(arr) {
var filtered = arr[1] // get string from array at index 1//
.toLowerCase() //make the string lower case//
.split("") // split the string in single characters //
.filter(letter => arr[0].toLowerCase().includes(letter)) // get a new array of characters that includes ONLY the characters that are also present in the string at index 0 of the array after turning it to lower case //
.join(""); // join the characters back together to create a string //
return arr[1].toLowerCase() === filtered; // if all of the second string characters are present in the first string, the string will be unchanged and when compared to string at index 1 turned to lower case it will return true, if not all characters were present the string will change and the variable filtered will not be equal to itself turned to lower case before applying all the methods above, and it will return false //
}