How can I skip an array element in .map?
.map
My code:
var sources = images.map(function (img) { if(img.src.split(\'.\').pop() === \"json
Here is the piece of code that achieves OP's goal using a single function :
const sources = images.flatMap( (img) => (img.split('.').pop() === "json") ? [] : [img] )
See the developer mozilla documentation of flatMap here