I have the following code:
var dataArray = [];
switch (request_url.query.group) {
case 'returning':
dataArray = {};
var returning = _.filter(result, function(result) {
return (result.sessions.length > 1) ? true : false;
});
//Am I setting the object dataArray here?
dataArray.returning = returning.length;
//Am I setting the array dataArray here?
dataArray['new'] = result.length - returning.length;
break;
I have confusion regarding dataArray here. The first line of code declares an array and in the switch case an object of the same name is declared. What is the 'new' and 'returning' values set and whom do it respectively belong to, the array or the object? Also, is object a super class of array in Node.js?