I am doing some challenges on edabit and I came across a problem with my output. So i have to Create a function that takes in an array (slot machine outcome) and returns true if all elements in the array are identical, and false otherwise. The array will contain 4 elements. Can someone explain why my code isn't working the right way.
I have tried with other inputs and it's working fine.
   'use strict';
   function array_Validator(e1,e2,e3,e4)
   {
       let m_Array=[e1,e2,e3,e4];
       for(let i=0;i<m_Array.length-1;i++)
       {
           for(let x=i;x<m_Array.length-1;x++)
           {
               if(m_Array[i]!==m_Array[x+1])
               {
                   return false;
               }
               else
               return true;
           }
       }
   }
  let u_Result=array_Validator("SS","SS","Ss","Ss");
   console.log(u_Result);
So when I input Ss it shoes true instead of false.
 
     
     
     
     
     
    