Mutation, the best solution, Need your Tought!?

Hi everybody

Finally, I found a solution to this challenge but is my code better than other’s ones?
I need an answer to these Questions:

what makes a code being considered as a Clean code?
what makes a code being considered as a Celever code?
what makes a code considered as a Best Practice code?

here is my code:

function mutation(arr) {
 let newArr = [];
 for(let i = 0; i < arr[1].length; i++){
 	var reg = new RegExp("[" + arr[1][i] + "]", "gi")
	newArr.push(reg.test(arr[0]));
  }
  return newArr.filter(a => a).length === newArr.length;
}

where you can put my code?

  • newbie
  • clever
  • Best Practice

You could use filter and avoid many lines of code. Even so, you are in a good path!! Nice work!

1 Like

thanks a lot @michelmarechal for your feedback :slight_smile: :blush: i appreciate it :slight_smile: