Monday, 10 July 2017

[Help] Data stream consistent with array but not Number...

My request consists in an array of length 3... for some reason the code snippet below logs the array with its content but return an undefined counter... any idea what I'm doing wrong?const express = require('express');const router = express.Router();var async = require("async");router.post('/someRoute',(req, res) => {var count = 0; var someArray = []; async.each(req.body,function(analysis, callback){ if (analysis.success){ someArray.push(analysis); count ++ } }, function(err,results){ console.log(someArray); console.log(count); }); });Edit: formatting

Submitted July 10, 2017 at 11:25AM by DepressedHypeman

No comments:

Post a Comment