I am having the following code. I want to check both condition and then push the value to array. But here the condition not working for me. I can't figure it out the issue. Does anyone knows?. Help really appreciated. Thank you.
let images = document.getElementsByTagName('img');
let srcList = [];
for(var i = 0; i < images.length; i++) {
let img = images[i].src;
let res = img.match(/ajax|email|icon|FB|social|small|close/gi);
let width = images[i].naturalWidth;
if((res==null)||(width >=150)) {
srcList.push(img);
}
}
Aucun commentaire:
Enregistrer un commentaire