How to find weather array have other elemnt or not : 

I have any array 

    var myArr = [1,1,1,1,1];
    if all the element in array then we return true and else false.
    	eg : myArr[1,1,1,1,1] return true;
    		 myArr[1,2,1,1,1] return false;
    		 
    for(var i=0; i<myArr.length; i++){
    	if(myArr[i] != myArr[i+1]){
    		flg = false; 
    	}
    	
    }

Can anyone help me to design this code.
