javascript - How to skip over an element in .map()? - Stack Overflow

PHOTO EMBED

Fri Feb 11 2022 03:28:36 GMT+0000 (Coordinated Universal Time)

Saved by @suppakan #javascript

var sources = images.filter(function(img) {
  if (img.src.split('.').pop() === "json") {
    return false; // skip
  }
  return true;
}).map(function(img) { return img.src; });
content_copyCOPY

https://stackoverflow.com/questions/24806772/how-to-skip-over-an-element-in-map