Skip to content

Instantly share code, notes, and snippets.

@omosehin
Last active September 11, 2019 11:10
Show Gist options
  • Save omosehin/6b6c664ba85088a1bc00b5b8a6bf0db3 to your computer and use it in GitHub Desktop.
Save omosehin/6b6c664ba85088a1bc00b5b8a6bf0db3 to your computer and use it in GitHub Desktop.
Function to test for identical array
const identical_Test = arr => {
for(let i = 0; i < arr.length - 1; i++) {
if(arr[i] !== arr[i+1]) {
return false;
}
}
return true;
}
var arrElement = ["avk", "avk", "avk", "avk"];
console.log(identical_Test(arrElement));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment