[javascript] How to skip over an element in .map()?

var sources = images.map(function (img) {
    if(img.src.split('.').pop() === "json"){ // if extension is .json
        return null; // skip
    }
    else{
        return img.src;
    }
}).filter(Boolean);

The .filter(Boolean) will filter out any falsey values in a given array, which in your case is the null.