A
A
Abc Edc2015-07-04 19:10:18
JavaScript
Abc Edc, 2015-07-04 19:10:18

Strange behavior of nulls in JS, how can this be?

It seems that I’m not new to JS, but for some reason I can’t understand this behavior, which is not standard for me personally. It
FE17eG7s8mA.jpg
doesn’t work like that.
And a little from the other side, coming up, working
Z9mT42Fn0W8.jpg
MB, I’m doing something wrong !?
Or is it the norm?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-07-04
Protko @Fesor

sorry, but what should work? In the first option, you always set vm.list to null,

function (data) {
    if (Array.isArray(data)) {
         vm.list = vm.list.concat(data);
    } else {
         vm.list = null;
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question