D
D
den4eg112015-12-14 04:06:32
Node.js
den4eg11, 2015-12-14 04:06:32

How to make the loop work?

for (var i = 0; i <= apples.length; i++) {

      module.Method(apples[i], (function (err, result){
        if (err){
          console.log(err);
          return;
        }
      }));
    }

I understand that it needs to be wrapped somehow correctly, but I don’t quite understand how, if a third-party module is used and it throws an error if there is not 45 for example (a certain number), but "i"
module, Method, apples - for ease of reading

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Алексей С., 2015-12-14
@den4eg11

forEach не проще использовать ?
у вас с кол-вом элементов в цикле перебор (или нет 0-го или нет равного apples.length)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question