Why does this code doesn't return false value for mutation challenge

Tell us what’s happening:
Describe your issue in detail here.

   **Your code so far**

function mutation(arr) {
 let arr2= arr.slice(1);
 let arr1 = arr.slice(0,1);

 for( let i = 0; i < arr2.length ; i++){
for( let j = 0; j< arr1.length; j++){
 var x= arr[i];
if( x == arr[j]){
  return true;
} else 
return false;
 return arr;

mutation(["hello", "hey"]);
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36

Challenge: Mutations

Link to the challenge:

First thing to look at, you’re indexing i and j based on arr2 and arr1 respectively… But what are you setting x to? And what are you then comparing that x to?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.