Tuesday, 6 June 2017

return values from Promise .then function [duplicate]

This question already has an answer here:

I read how to return values from Promise.then in SO before posting my question but I couldn't figure out how to return values in my case. In node prompt :

var geoCode = require('no-network-geocoder');

geoCode('Istanbul').then(function(dataObj){
var geox = dataObj.latitude;
var geoy = dataObj.longitude;
console.log(geox, geoy);
return [geox, geoy];
})

it prints the values geox, geoy but how can I reach them from outside? It's like two concatenated functions and I can not get the value like var geom = geoCode().geox



via kenn

No comments:

Post a Comment