📅  最后修改于: 2022-03-11 15:04:15.144000             🧑  作者: Mango
// find all images without alternate text and give them a red border
function processImages() {
// Get all images
const images = document.querySelectorAll('img')
// Loop through all images
images.forEach(image =>
// If the image has no alt attribute give it a red border
!image.alt ? (image.style.border = '1px solid red') : null
)
}