我做错了什么? desc返回undefined,一切都很好,直到最后一个语句。 desc在函数内部有一个值。
function row_click(e)
{
var desc;
var statement = "CYPHER runtime=compiled MATCH (m) where m.ID='" +e +"' with m as m RETURN m.Description as desc";
session.run(statement)
.then (function(result) {
var records = [];
for (i = 0; i < result.records.length; i++) {
records.push(result.records[i]);
}
return records;
})
.then(function(records){
for(i = 0; i < records.length; i ++)
{
descrip=records[i].get("desc");
}
desc= descrip;
});
console.log(desc);
}