The judgement of traversing the same element in javascript Multi-dimensional Array

first I get an array dynamically, and their name values may be the same or different.
is similar to the following structure. Maybe you get arr, maybe you get arr2.

var arr = [{id:1,name:2},{id:2,name:2},...]; //name
var arr2 = [{id:1,name:2},{id:2,name:223222},....]; //name

what I want to ask is: when I get this array and iterate through its name value, how can I tell if the name value is the same, that is, true; is false? if it is not the same?

Apr.03,2021

!arr.some(function(el, index) {
    return el.name != arr[index-1 < 0 ? 0 : index -1].name
})
Menu