JS: рекурсивная функция возвращает undefined

Jack

Client
Регистрация
30.03.2016
Сообщения
49
Благодарностей
0
Баллы
6
https://gyazo.com/3d3c280ccfe49260f8539b54936d7f3d

Тот же код в ff:
https://gyazo.com/7b2a7a39293e2918fcf31791c2bacc70

Страница:
https://photofocus.com/2016/03/18/more-affordable-camera-stableizerstripods-from-adorama/

Код:
Код:
var context = document.querySelectorAll(".entry-content")[0];

function recurs(oldContext){
    var cnt = oldContext.childNodes.length;

    if (cnt != 0) {
        var context = oldContext.childNodes[0];
        return recurs(context);
    } else {
        // console.log(oldContext.getAttribute('src'));
        if (oldContext.getAttribute('src')) {
            return oldContext.getAttribute('src');
        } else {
            return false;
        }
    }
}

recurs(context.childNodes[0]);
 

Jack

Client
Регистрация
30.03.2016
Сообщения
49
Благодарностей
0
Баллы
6
Как полезно бывает написать тикет, сразу вижу в чем дело. return в последней строчке. Всем спасибо, все свободны))
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)