script.js
// Check the order of list items
Check the order of list items
Check the order of list items
function checkOrder() {
  listItems.forEach((listItem, index) => {
    const personName = listItem.querySelector('.draggable').innerText.trim();
    if (personName !== richestPeople[index]) {
      listItem.classList.add('wrong');
    } else {
      listItem.classList.remove('wrong');
      listItem.classList.add('right');
    }
  });
}
function checkOrder ( ) { listItems . forEach ( ( listItem , index ) => { const personName = listItem . querySelector ( '.draggable' ) . innerText . trim ( ) ; if ( personName !== richestPeople [ index ] ) { listItem . classList . add ( 'wrong' ) ; } else { listItem . classList . remove ( 'wrong' ) ; listItem . classList . add ( 'right' ) ; } } ) ; }
Check the order of list items
Check the order of list items