js push the items that are not numbers into a seperate array code example
Example 1: javascript array push
var SomeRandomArray = [];
SomeRandomArray.push("Hello, world!");
Example 2: what does results.push({}) nodejs mean
const mongoose = require('mongoose');
var data = async function () {
var array = [];
const finalResults = await new Promise((resolve, reject) => {
mongoose.connection.collection("organizations").find({}).toArray(function(err, result) {
resolve(result);
});
});
for(var i = 0; i < finalResults.length; i++)
{
var a = finalResults[i].name;
array.push(a);
}
return array;
};
module.exports = {
data: data,
};