// 获取容器
const container = document.querySelector('.container');
// 获取所有div元素
const divs = container.querySelectorAll('div');
// 遍历div元素
divs.forEach((div, index) => {
// 获取当前div的高度
const height = div.offsetHeight;
// 比较当前div的高度与下一个div的高度
if(index < divs.length - 1) {
const nextHeight = divs[index+1].offsetHeight;
if(height > nextHeight) {
console.log(`第${index+1}个div高度大于第${index+2}个div高度`);
} else {
console.log(`第${index+2}个div高度大于第${index+1}个div高度`);
}
}
});