How to use the sample function from underscore
Find comprehensive JavaScript underscore.sample code examples handpicked from public code repositorys.
21 22 23 24 25 26 27 28 29 30
if (child.data.url.endsWith('jpg') || child.data.url.endsWith('jpeg') || child.data.url.endsWith('png') || child.data.url.endsWith('gif')) { images.push(child.data.url); } } }); var image = _.sample(images); return image; } else { return null; }
0
4
2
+ 2 other calls in file
underscore.keys is the most popular function in underscore (11266 examples)