I have a function like this:
function get_projects() {
var project_names=[];
knex('projects').select('name').then(function (a) {
project_names.push(a);
})
return project_names;
}
This function executes the return statement return project_names; before completing project_names.push(a) statement and what I get after calling this function is an empty array, even though my db has results (I can see this if i log within the function a())