I have some problem with WHILE, idk why.
do {
url = find[o['random'].random(0, find.length)];
sliced4 = url.slice(url.length-4,url.length);
sliced5 = url.slice(url.length-5,url.length);
c++;
console.log(c+' '+sliced4+'-'+sliced5);
if (c > 5) {
o['bot'].send('Похоже, таких изображений не существует.', o['body'], {});
return;
}
} while(sliced4 !== '.jpg' || sliced4 !== '.png' || sliced5 !== '.jpeg');
find[] contain links to images from Google.Images
Result from console(it's mean that code must working, because sliced4 == '.jpg'):